| 1 |
// PR c++/84192 |
| 2 |
// { dg-do compile { target c++14 } } |
| 3 |
// { dg-options "" } |
| 4 |
|
| 5 |
bool |
| 6 |
f1 () |
| 7 |
{ |
| 8 |
return ({ return true; }) && false; // { dg-error "could not convert" } |
| 9 |
} |
| 10 |
|
| 11 |
void |
| 12 |
f2 () |
| 13 |
{ |
| 14 |
for (;;) |
| 15 |
constexpr bool b = ({ break; false; }) && false; // { dg-error "is not a constant expression" } |
| 16 |
} |
| 17 |
|
| 18 |
constexpr bool |
| 19 |
f3 (int n) |
| 20 |
{ |
| 21 |
bool b = false; |
| 22 |
for (int i = 0; i < n; i++) |
| 23 |
b = ({ break; }); // { dg-error "void value not ignored as it ought to be" } |
| 24 |
return b; |
| 25 |
} |
| 26 |
|
| 27 |
constexpr bool b = f3 (4); |
| 28 |
|
| 29 |
bool |
| 30 |
f4 () |
| 31 |
{ |
| 32 |
constexpr bool b = ({ return true; }) && false; // { dg-error "could not convert" } |
| 33 |
return false; |
| 34 |
} |
| 35 |
|
| 36 |
constexpr bool |
| 37 |
f5 (int x) |
| 38 |
{ |
| 39 |
constexpr bool b = ({ switch (x) case 0: true; }) && false; // { dg-error "could not convert" } |
| 40 |
return false; |
| 41 |
} |