diff options
Diffstat (limited to 'test/SemaCXX/cxx1y-generic-lambdas.cpp')
-rw-r--r-- | test/SemaCXX/cxx1y-generic-lambdas.cpp | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/test/SemaCXX/cxx1y-generic-lambdas.cpp b/test/SemaCXX/cxx1y-generic-lambdas.cpp index 9f3c77591a861..7c3b970ae8f6a 100644 --- a/test/SemaCXX/cxx1y-generic-lambdas.cpp +++ b/test/SemaCXX/cxx1y-generic-lambdas.cpp @@ -181,7 +181,7 @@ int test() { int (*fp2)(int) = [](auto b) -> int { return b; }; int (*fp3)(char) = [](auto c) -> int { return c; }; char (*fp4)(int) = [](auto d) { return d; }; //expected-error{{no viable conversion}}\ - //expected-note{{candidate template ignored}} + //expected-note{{candidate function [with $0 = int]}} char (*fp5)(char) = [](auto e) -> int { return e; }; //expected-error{{no viable conversion}}\ //expected-note{{candidate template ignored}} @@ -207,12 +207,22 @@ int variadic_test() { } // end ns namespace conversion_operator { -void test() { - auto L = [](auto a) -> int { return a; }; + void test() { + auto L = [](auto a) -> int { return a; }; // expected-error {{cannot initialize}} int (*fp)(int) = L; int (&fp2)(int) = [](auto a) { return a; }; // expected-error{{non-const lvalue}} int (&&fp3)(int) = [](auto a) { return a; }; // expected-error{{no viable conversion}}\ //expected-note{{candidate}} + + using F = int(int); + using G = int(void*); + L.operator F*(); + L.operator G*(); // expected-note-re {{instantiation of function template specialization '{{.*}}::operator()<void *>'}} + + // Here, the conversion function is named 'operator auto (*)(int)', and + // there is no way to write that name in valid C++. + auto M = [](auto a) -> auto { return a; }; + M.operator F*(); // expected-error {{no member named 'operator int (*)(int)'}} } } } @@ -992,4 +1002,4 @@ namespace PR32638 { void test() { [](auto x) noexcept(noexcept(x)) { } (0); } -}
\ No newline at end of file +} |