| 1 |
// PR c++/78337 |
| 2 |
// { dg-do compile { target c++14 } } |
| 3 |
|
| 4 |
struct X { |
| 5 |
static constexpr int foo (int b) { |
| 6 |
return b; |
| 7 |
} |
| 8 |
}; |
| 9 |
|
| 10 |
template<int> |
| 11 |
using Void = void; |
| 12 |
|
| 13 |
template<typename F,typename A> |
| 14 |
auto |
| 15 |
bar(F f, A a) -> decltype( ( f(a) , 0 ) ) // { dg-message "" } |
| 16 |
{ return {}; } |
| 17 |
|
| 18 |
|
| 19 |
int main() { |
| 20 |
//constexpr |
| 21 |
int f = 3; |
| 22 |
(void)f; |
| 23 |
auto l = [](auto of_type_X)-> |
| 24 |
Void<(decltype(of_type_X)::foo(f), 0)> // { dg-error "variable" } |
| 25 |
{return;}; |
| 26 |
bar(l , X{}); // { dg-error "no match" } |
| 27 |
} |