From 42acd4a05b523f53e6708cdbb77a4a10c352a03c Mon Sep 17 00:00:00 2001 From: Sebastian Redl Date: Tue, 17 Jan 2012 22:50:08 +0000 Subject: Auto deduction support for std::initializer_list, including for-range support. This means you can now write: for (int i : {1, 4, 512, 23, 251}) {} llvm-svn: 148353 --- clang/test/SemaCXX/cxx0x-initializer-stdinitializerlist.cpp | 8 ++++++++ 1 file changed, 8 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 a08a04806ca..47ceaf0b83c 100644 --- a/clang/test/SemaCXX/cxx0x-initializer-stdinitializerlist.cpp +++ b/clang/test/SemaCXX/cxx0x-initializer-stdinitializerlist.cpp @@ -109,3 +109,11 @@ void argument_deduction() { deduce_ref({1, 2.0}); // expected-error {{no matching function}} } + +void auto_deduction() { + auto l = {1, 2, 3, 4}; + static_assert(same_type>::value, ""); + auto bl = {1, 2.0}; // expected-error {{cannot deduce}} + + for (int i : {1, 2, 3, 4}) {} +} -- cgit v1.2.3