1 // RUN: %clang_cc1 -fsyntax-only -std=c++11 %s -verify
3 void test_conversion() {
4 int (*fp1)(int) = [](int x) { return x + 1; };
5 void (*fp2)(int) = [](int x) { };
7 const auto lambda = [](int x) { };
8 void (*fp3)(int) = lambda;
10 volatile const auto lambda2 = [](int x) { }; // expected-note{{but method is not marked volatile}}
11 void (*fp4)(int) = lambda2; // expected-error{{no viable conversion}}
14 void test_no_conversion() {
15 int (*fp1)(int) = [=](int x) { return x + 1; }; // expected-error{{no viable conversion}}
16 void (*fp2)(int) = [&](int x) { }; // expected-error{{no viable conversion}}
20 const auto l = [](int x) mutable -> int { return + 1; };
21 l(17); // okay: uses conversion function