From 1ae689c2b8759e4cb5bc9ff334b02c58752f2717 Mon Sep 17 00:00:00 2001 From: Richard Smith Date: Wed, 28 Jan 2015 22:06:01 +0000 Subject: PR22367: Don't forget to create a CXXFunctionalCastExpr around list-initialization that gets converted to some form other than an InitListExpr. CXXTemporaryObjectExpr is a special case here, because it represents a fused CXXFunctionalCastExpr + CXXConstructExpr. That, in itself, is probably a design error... llvm-svn: 227377 --- .../test/SemaCXX/cxx0x-initializer-stdinitializerlist.cpp | 15 +++++++++++++++ 1 file changed, 15 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 70f7c642a54..e7b515305d4 100644 --- a/clang/test/SemaCXX/cxx0x-initializer-stdinitializerlist.cpp +++ b/clang/test/SemaCXX/cxx0x-initializer-stdinitializerlist.cpp @@ -259,3 +259,18 @@ namespace ListInitInstantiate { template void g() { int k = f({0}); } template void g(); } + +namespace TemporaryInitListSourceRange_PR22367 { + struct A { + constexpr A() {} + A(std::initializer_list); // expected-note {{here}} + }; + constexpr int f(A) { return 0; } + constexpr int k = f( // expected-error {{must be initialized by a constant expression}} + // The point of this test is to check that the caret points to + // 'std::initializer_list', not to '{0}'. + std::initializer_list // expected-note {{constructor}} + + {0} + ); +} -- cgit v1.2.3