From 06d4ba388873e6d1cfa9cd715a8935ecc8cd2097 Mon Sep 17 00:00:00 2001 From: Dimitry Andric Date: Sun, 18 Jan 2015 16:23:48 +0000 Subject: Vendor import of clang RELEASE_360/rc1 tag r226102 (effectively, 3.6.0 RC1): https://llvm.org/svn/llvm-project/cfe/tags/RELEASE_360/rc1@226102 --- test/SemaCXX/lambda-expressions.cpp | 80 +++++++++++++++++++++++++++++++++++-- 1 file changed, 77 insertions(+), 3 deletions(-) (limited to 'test/SemaCXX/lambda-expressions.cpp') diff --git a/test/SemaCXX/lambda-expressions.cpp b/test/SemaCXX/lambda-expressions.cpp index 9a53e4604f76..cad322ab52fe 100644 --- a/test/SemaCXX/lambda-expressions.cpp +++ b/test/SemaCXX/lambda-expressions.cpp @@ -258,9 +258,7 @@ namespace TypeDeduction { void f() { const S s {}; S &&t = [&] { return s; } (); -#if __cplusplus <= 201103L - // expected-error@-2 {{drops qualifiers}} -#else +#if __cplusplus > 201103L S &&u = [&] () -> auto { return s; } (); #endif } @@ -363,3 +361,79 @@ namespace PR18473 { void PR19249() { auto x = [&x]{}; // expected-error {{cannot appear in its own init}} } + +namespace PR20731 { +template +void Job(L l); + +template +void Logger(Args &&... args) { + auto len = Invalid_Function((args)...); + // expected-error@-1 {{use of undeclared identifier 'Invalid_Function'}} + Job([len]() {}); +} + +void GetMethod() { + Logger(); + // expected-note@-1 {{in instantiation of function template specialization 'PR20731::Logger<>' requested here}} +} + +template +struct A { + T t; + // expected-error@-1 {{field has incomplete type 'void'}} +}; + +template +void g(F f) { + auto a = A{}; + // expected-note@-1 {{in instantiation of template class 'PR20731::A' requested here}} + auto xf = [a, f]() {}; + int x = sizeof(xf); +}; +void f() { + g([] {}); + // expected-note-re@-1 {{in instantiation of function template specialization 'PR20731::g<(lambda at {{.*}}>' requested here}} +} + +template struct function { + template + function(_Fp) { + static_assert(sizeof(_Fp) > 0, "Type must be complete."); + } +}; + +template void p(T t) { + auto l = some_undefined_function(t); + // expected-error@-1 {{use of undeclared identifier 'some_undefined_function'}} + function(([l]() {})); +} +void q() { p(0); } +// expected-note@-1 {{in instantiation of function template specialization 'PR20731::p' requested here}} +} + +namespace lambda_in_default_mem_init { + template void f() { + struct S { int n = []{ return 0; }(); }; + } + template void f(); + + template void g() { + struct S { int n = [](int n){ return n; }(0); }; + } + template void g(); +} + +namespace error_in_transform_prototype { + template + void f(T t) { + // expected-error@+2 {{type 'int' cannot be used prior to '::' because it has no members}} + // expected-error@+1 {{no member named 'ns' in 'error_in_transform_prototype::S'}} + auto x = [](typename T::ns::type &k) {}; + } + class S {}; + void foo() { + f(5); // expected-note {{requested here}} + f(S()); // expected-note {{requested here}} + } +} -- cgit v1.2.3