diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2015-11-11 01:36:17 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2015-11-11 01:36:17 +0000 |
commit | 42b10572443e3f3f3c4a113f88ad4e9b504df900 (patch) | |
tree | b826b89beb307ed24b6ffedf840c5605ccabb3f4 /clang/test/CXX/expr/expr.prim/expr.prim.lambda/p11-1y.cpp | |
parent | 754cd11d9019e62a4c6a0aee62159e707f6f51d9 (diff) | |
download | bcm5719-llvm-42b10572443e3f3f3c4a113f88ad4e9b504df900.tar.gz bcm5719-llvm-42b10572443e3f3f3c4a113f88ad4e9b504df900.zip |
N3922: direct-list-initialization of an auto-typed variable no longer deduces a
std::initializer_list<T> type. Instead, the list must contain a single element
and the type is deduced from that.
In Clang 3.7, we warned by default on all the cases that would change meaning
due to this change. In Clang 3.8, we will support only the new rules -- per
the request in N3922, this change is applied as a Defect Report against earlier
versions of the C++ standard.
This change is not entirely trivial, because for lambda init-captures we
previously did not track the difference between direct-list-initialization and
copy-list-initialization. The difference was not previously observable, because
the two forms of initialization always did the same thing (the elements of the
initializer list were always copy-initialized regardless of the initialization
style used for the init-capture).
llvm-svn: 252688
Diffstat (limited to 'clang/test/CXX/expr/expr.prim/expr.prim.lambda/p11-1y.cpp')
-rw-r--r-- | clang/test/CXX/expr/expr.prim/expr.prim.lambda/p11-1y.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/clang/test/CXX/expr/expr.prim/expr.prim.lambda/p11-1y.cpp b/clang/test/CXX/expr/expr.prim/expr.prim.lambda/p11-1y.cpp index 1228c74b070..63e51a76144 100644 --- a/clang/test/CXX/expr/expr.prim/expr.prim.lambda/p11-1y.cpp +++ b/clang/test/CXX/expr/expr.prim/expr.prim.lambda/p11-1y.cpp @@ -48,7 +48,8 @@ auto bad_init_2 = [a(1, 2)] {}; // expected-error {{initializer for lambda captu auto bad_init_3 = [&a(void_fn())] {}; // expected-error {{cannot form a reference to 'void'}} auto bad_init_4 = [a(void_fn())] {}; // expected-error {{has incomplete type 'void'}} auto bad_init_5 = [a(overload_fn)] {}; // expected-error {{cannot deduce type for lambda capture 'a' from initializer of type '<overloaded function}} -auto bad_init_6 = [a{overload_fn}] {}; // expected-error {{cannot deduce type for lambda capture 'a' from initializer list}} expected-warning {{will change meaning in a future version of Clang}} +auto bad_init_6 = [a{overload_fn}] {}; // expected-error {{cannot deduce type for lambda capture 'a' from initializer list}} +auto bad_init_7 = [a{{1}}] {}; // expected-error {{cannot deduce type for lambda capture 'a' from nested initializer list}} template<typename...T> void pack_1(T...t) { (void)[a(t...)] {}; } // expected-error {{initializer missing for lambda capture 'a'}} template void pack_1<>(); // expected-note {{instantiation of}} @@ -61,7 +62,7 @@ auto a = [a(4), b = 5, &c = static_cast<const int&&>(0)] { using T = decltype(c); using T = const int &; }; -auto b = [a{0}] {}; // expected-error {{include <initializer_list>}} expected-warning {{will change meaning in a future version of Clang}} +auto b = [a{0}] {}; // OK, per N3922 struct S { S(); S(S&&); }; template<typename T> struct remove_reference { typedef T type; }; |