| 1 |
// { dg-do run { target c++11 } } |
| 2 |
// { dg-skip-if "requires hosted libstdc++ for cassert" { ! hostedlib } } |
| 3 |
|
| 4 |
// Make sure -Wliteral-suffix is enabled by default and |
| 5 |
// triggers as expected. |
| 6 |
|
| 7 |
#define BAR "bar" |
| 8 |
#define PLUS_ONE + 1 |
| 9 |
|
| 10 |
#include <cstdint> |
| 11 |
#include <cassert> |
| 12 |
|
| 13 |
|
| 14 |
void |
| 15 |
test() |
| 16 |
{ |
| 17 |
char c = '3'PLUS_ONE; // { dg-warning "invalid suffix on literal" } |
| 18 |
char s[] = "foo"BAR; // { dg-warning "invalid suffix on literal" } |
| 19 |
|
| 20 |
assert(c == '4'); |
| 21 |
assert(s[3] != '\0'); |
| 22 |
assert(s[3] == 'b'); |
| 23 |
} |
| 24 |
|
| 25 |
int |
| 26 |
main() |
| 27 |
{ |
| 28 |
test(); |
| 29 |
} |