gcc/testsuite/g++.dg/parse/constant5.C
raw| 1 | // { dg-options "-std=c++98 -pedantic-errors" } |
| 2 | |
| 3 | enum E { |
| 4 | a = 24.2, // { dg-error "integral|constant" } |
| 5 | b = (int)3.7, |
| 6 | c = int(4.2), |
| 7 | d = (int)(4.2 + 3.7), // { dg-error "constant" } |
| 8 | e = int(4.2 - 3.7), // { dg-error "constant" } |
| 9 | f = (int)17.25 |
| 10 | }; |
| 11 | |
| 12 | struct S { |
| 13 | static const int i = (int)4.2; |
| 14 | int j[(int)4.2]; |
| 15 | static const int k = static_cast<short>(3.7); |
| 16 | }; |