summaryrefslogtreecommitdiff
path: root/clang/test/CXX
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2018-07-02 23:25:22 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2018-07-02 23:25:22 +0000
commitd28304ae3769554ae737c684a88702949881ef19 (patch)
treee5fda4145295d3d8383f0d106ee79adc77022843 /clang/test/CXX
parentc74dc0f85c6842ad1fcab8dd901910fa6a249f2c (diff)
Per C++ [over.match.copy]p1, direct-initialization of a reference can
only invoke converting constructors of the reference's underlying type.
Diffstat (limited to 'clang/test/CXX')
-rw-r--r--clang/test/CXX/dcl.decl/dcl.init/dcl.init.ref/p5.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/clang/test/CXX/dcl.decl/dcl.init/dcl.init.ref/p5.cpp b/clang/test/CXX/dcl.decl/dcl.init/dcl.init.ref/p5.cpp
index e775e8f0e3c..869fc4f0149 100644
--- a/clang/test/CXX/dcl.decl/dcl.init/dcl.init.ref/p5.cpp
+++ b/clang/test/CXX/dcl.decl/dcl.init/dcl.init.ref/p5.cpp
@@ -61,3 +61,12 @@ namespace test3 {
unsigned &t9 = (a->bitY += 3); // expected-error {{non-const reference cannot bind to bit-field 'bitY'}}
}
}
+
+namespace explicit_ctor {
+ struct A {};
+ struct B { // expected-note 2{{candidate}}
+ explicit B(const A&);
+ };
+ A a;
+ const B &b(a); // expected-error {{no viable conversion}}
+}