gcc/testsuite/g++.dg/cpp0x/lambda/lambda-defarg8.C
raw| 1 | // PR c++/82282 |
| 2 | // { dg-do compile { target c++14 } } |
| 3 | |
| 4 | template<typename = int> |
| 5 | void f(const char* a = |
| 6 | ([](int = []{ static int i; return 42; }()) { |
| 7 | static int i; |
| 8 | return ""; |
| 9 | }())); |
| 10 | |
| 11 | template<typename = int> |
| 12 | struct X { |
| 13 | void f(const char* a = |
| 14 | ([](int = [] { static int i; return 42; }()) { |
| 15 | enum { Size = 42 - 1 }; |
| 16 | return ""; |
| 17 | }())); |
| 18 | }; |
| 19 | |
| 20 | void g() |
| 21 | { |
| 22 | f(); |
| 23 | X<int>().f(); |
| 24 | } |