| 1 |
// PR c++/97536 |
| 2 |
// { dg-do compile { target concepts } } |
| 3 |
|
| 4 |
template<typename> |
| 5 |
concept C1 = true; |
| 6 |
|
| 7 |
concept C2 = true; // { dg-error "non-template variable cannot be .concept." } |
| 8 |
// { dg-error "concept definition syntax is" "" { target *-*-* } .-1 } |
| 9 |
|
| 10 |
template<typename> |
| 11 |
void fn1 () |
| 12 |
{ |
| 13 |
concept bar = true; // { dg-error "concept must be defined at namespace scope" } |
| 14 |
// { dg-error "concept definition syntax is" "" { target *-*-* } .-1 } |
| 15 |
} |
| 16 |
|
| 17 |
void fn2 () |
| 18 |
{ |
| 19 |
concept bar = true; // { dg-error "non-template variable cannot be .concept." } |
| 20 |
// { dg-error "concept definition syntax is" "" { target *-*-* } .-1 } |
| 21 |
} |
| 22 |
|
| 23 |
template<typename> |
| 24 |
void fn3 () |
| 25 |
{ |
| 26 |
template<typename> // { dg-error "template declaration cannot appear at block scope" } |
| 27 |
concept bar = true; |
| 28 |
} |
| 29 |
|
| 30 |
void fn4 () |
| 31 |
{ |
| 32 |
template<typename> // { dg-error "template declaration cannot appear at block scope" } |
| 33 |
concept bar = true; |
| 34 |
} |
| 35 |
|
| 36 |
void fn5 () |
| 37 |
{ |
| 38 |
C1 auto x = 42; |
| 39 |
} |
| 40 |
|
| 41 |
template<typename> |
| 42 |
void fn6 () |
| 43 |
{ |
| 44 |
C1 auto x = 42; |
| 45 |
} |