Revert "[llvm] Improve llvm.objectsize computation by computing GEP, alloca and mallo...
[llvm-project.git] / clang / test / CXX / expr / expr.prim / expr.prim.lambda / p6.cpp
blob533bea5d5cb74a3a5334ba9bcf0f1f4409ff3220
1 // RUN: %clang_cc1 -fsyntax-only -std=c++11 %s -verify
2 // RUN: %clang_cc1 -fsyntax-only -std=c++1z %s -verify
3 // RUN: %clang_cc1 -fsyntax-only -std=c++11 %s -triple i386-windows-pc -verify
4 // RUN: %clang_cc1 -fsyntax-only -std=c++1z %s -triple i386-windows-pc -verify
6 void test_conversion() {
7 int (*fp1)(int) = [](int x) { return x + 1; };
8 void (*fp2)(int) = [](int x) { };
10 const auto lambda = [](int x) { };
11 void (*fp3)(int) = lambda;
13 volatile const auto lambda2 = [](int x) { }; // expected-note{{but method is not marked volatile}}
14 void (*fp4)(int) = lambda2; // expected-error{{no viable conversion}}
16 void (*fp5)(int) noexcept = [](int x) { };
17 #if __cplusplus > 201402L
18 // expected-error@-2 {{no viable}} expected-note@-2 {{candidate}}
19 void (*fp5a)(int) noexcept = [](auto x) { };
20 // expected-error@-1 {{no viable}} expected-note@-1 {{candidate}}
21 void (*fp5b)(int) noexcept = [](auto x) noexcept { };
22 #endif
23 void (*fp6)(int) noexcept = [](int x) noexcept { };
26 void test_no_conversion() {
27 int (*fp1)(int) = [=](int x) { return x + 1; }; // expected-error{{no viable conversion}}
28 void (*fp2)(int) = [&](int x) { }; // expected-error{{no viable conversion}}
31 void test_wonky() {
32 const auto l = [](int x) mutable -> int { return + 1; };
33 l(17); // okay: uses conversion function