From 73cfbebed4c3a7d49b7256667e7e357ddcee65e2 Mon Sep 17 00:00:00 2001 From: Sebastian Redl Date: Sun, 19 Feb 2012 16:31:05 +0000 Subject: Emit a warning when list-initializing a std::initializer_list member. llvm-svn: 150933 --- clang/test/SemaCXX/cxx0x-initializer-stdinitializerlist.cpp | 9 +++++++++ 1 file changed, 9 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 bfe3f7991ea..6c299c7d8a1 100644 --- a/clang/test/SemaCXX/cxx0x-initializer-stdinitializerlist.cpp +++ b/clang/test/SemaCXX/cxx0x-initializer-stdinitializerlist.cpp @@ -127,3 +127,12 @@ void dangle() { new auto{1, 2, 3}; // expected-error {{cannot use list-initialization}} new std::initializer_list{1, 2, 3}; // expected-warning {{at the end of the full-expression}} } + +struct haslist1 { + std::initializer_list il = {1, 2, 3}; // expected-warning{{at the end of the constructor}} + haslist1(); +}; + +haslist1::haslist1() +: il{1, 2, 3} // expected-warning{{at the end of the constructor}} +{} -- cgit v1.2.3