summaryrefslogtreecommitdiff
path: root/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
commit2a670227465c2be203f30650676da8b51715c44f (patch)
tree5fbc1b35dfc91baf158bc084b8eb487b3ddda810 /test/CXX
parentddb77a4e35a61b758922bc15fb68c8ca224655e5 (diff)
downloadclang-2a670227465c2be203f30650676da8b51715c44f.tar.gz
Per C++ [over.match.copy]p1, direct-initialization of a reference can
only invoke converting constructors of the reference's underlying type. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@336153 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CXX')
-rw-r--r--test/CXX/dcl.decl/dcl.init/dcl.init.ref/p5.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/test/CXX/dcl.decl/dcl.init/dcl.init.ref/p5.cpp b/test/CXX/dcl.decl/dcl.init/dcl.init.ref/p5.cpp
index e775e8f0e3..869fc4f014 100644
--- a/test/CXX/dcl.decl/dcl.init/dcl.init.ref/p5.cpp
+++ b/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}}
+}