diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2013-06-13 00:57:57 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2013-06-13 00:57:57 +0000 |
commit | 2eabf78eb6affeece016b71a2df152c7aa38db4d (patch) | |
tree | de35cb07a1133d69c3847dd3581d107fe8eb43c6 /clang/test/SemaCXX/references.cpp | |
parent | 2c308503ea8b726369dc7cb475cea7a306dc7b7e (diff) | |
download | bcm5719-llvm-2eabf78eb6affeece016b71a2df152c7aa38db4d.tar.gz bcm5719-llvm-2eabf78eb6affeece016b71a2df152c7aa38db4d.zip |
When copy-initializing a temporary for a reference binding, don't allow use of
explicit constructors.
llvm-svn: 183879
Diffstat (limited to 'clang/test/SemaCXX/references.cpp')
-rw-r--r-- | clang/test/SemaCXX/references.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/clang/test/SemaCXX/references.cpp b/clang/test/SemaCXX/references.cpp index 4f3dab0514b..37fc2a856fd 100644 --- a/clang/test/SemaCXX/references.cpp +++ b/clang/test/SemaCXX/references.cpp @@ -137,3 +137,10 @@ namespace PR8608 { // The following crashed trying to recursively evaluate the LValue. const int &do_not_crash = do_not_crash; // expected-warning{{reference 'do_not_crash' is not yet bound to a value when used within its own initialization}} + +namespace ExplicitRefInit { + // This is invalid: we can't copy-initialize an 'A' temporary using an + // explicit constructor. + struct A { explicit A(int); }; + const A &a(0); // expected-error {{reference to type 'const ExplicitRefInit::A' could not bind to an rvalue of type 'int'}} +} |