summaryrefslogtreecommitdiffstats
path: root/clang/test/SemaCXX/cxx0x-initializer-references.cpp
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2014-09-04 22:13:39 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2014-09-04 22:13:39 +0000
commit8d082d187e573988ef9e3e5ecbbe2553bdeb5a70 (patch)
tree6e8818fcd9c3a272cd2e6d81be9718711faa29c8 /clang/test/SemaCXX/cxx0x-initializer-references.cpp
parent1b23158ce419a1c67a27aa45ec9f2a5b26b6b9a9 (diff)
downloadbcm5719-llvm-8d082d187e573988ef9e3e5ecbbe2553bdeb5a70.tar.gz
bcm5719-llvm-8d082d187e573988ef9e3e5ecbbe2553bdeb5a70.zip
PR20844: If we fail to list-initialize a reference, map to the referenced type
before retrying the initialization to produce diagnostics. Otherwise, we may fail to produce any diagnostics, and silently produce invalid AST in a -Asserts build. Also add a note to this codepath to make it more clear why we were trying to create a temporary. llvm-svn: 217197
Diffstat (limited to 'clang/test/SemaCXX/cxx0x-initializer-references.cpp')
-rw-r--r--clang/test/SemaCXX/cxx0x-initializer-references.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/clang/test/SemaCXX/cxx0x-initializer-references.cpp b/clang/test/SemaCXX/cxx0x-initializer-references.cpp
index 9096c8a1c2d..d1a9ed30076 100644
--- a/clang/test/SemaCXX/cxx0x-initializer-references.cpp
+++ b/clang/test/SemaCXX/cxx0x-initializer-references.cpp
@@ -118,3 +118,9 @@ namespace inner_init {
F f2 { { 0 } }; // expected-error {{chosen constructor is explicit}}
F f3 { { { 0 } } }; // expected-error {{chosen constructor is explicit}}
}
+
+namespace PR20844 {
+ struct A {};
+ struct B { operator A&(); } b;
+ A &a{b}; // expected-error {{excess elements}} expected-note {{in initialization of temporary of type 'PR20844::A'}}
+}
OpenPOWER on IntegriCloud