From 4a09e8872f37b191e70a0664e687aae38549390c Mon Sep 17 00:00:00 2001 From: Reid Kleckner Date: Wed, 9 Dec 2015 23:18:38 +0000 Subject: Fix crash on invalid initialization with std::initializer_list It is possible for CheckListElementTypes to fail without filling in any initializer list elements. llvm-svn: 255176 --- .../cxx0x-initializer-stdinitializerlist.cpp | 25 ++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'clang/test/SemaCXX/cxx0x-initializer-stdinitializerlist.cpp') diff --git a/clang/test/SemaCXX/cxx0x-initializer-stdinitializerlist.cpp b/clang/test/SemaCXX/cxx0x-initializer-stdinitializerlist.cpp index 3d119643710..060a0f236b4 100644 --- a/clang/test/SemaCXX/cxx0x-initializer-stdinitializerlist.cpp +++ b/clang/test/SemaCXX/cxx0x-initializer-stdinitializerlist.cpp @@ -284,3 +284,28 @@ namespace ParameterPackNestedInitializerLists_PR23904c3 { void foo() { f({{0}}, {{'\0'}}); } } + +namespace update_rbrace_loc_crash { + // We used to crash-on-invalid on this example when updating the right brace + // location. + template + struct A {}; + template + std::initializer_list ExplodeImpl(F p1, A) { + // expected-error@+1 {{reference to type 'const update_rbrace_loc_crash::Incomplete' could not bind to an rvalue of type 'void'}} + return {p1(I)...}; + } + template + void Explode(F p1) { + // expected-note@+1 {{in instantiation of function template specialization}} + ExplodeImpl(p1, A()); + } + class Incomplete; + struct ContainsIncomplete { + const Incomplete &obstacle; + }; + void f() { + // expected-note@+1 {{in instantiation of function template specialization}} + Explode([](int) {}); + } +} -- cgit v1.2.3