5
5
6
6
/// This is a version of test/Sema/const-eval.c with the
7
7
/// tests commented out that the new constant expression interpreter does
8
- /// not support yet. They are all marked with the NEW_INTERP define:
9
- ///
10
- /// - builtin_constant_p
11
- /// - unions
12
-
8
+ /// not support yet. They are all marked with the NEW_INTERP define.
13
9
14
10
#define EVAL_EXPR (testno , expr ) enum { test##testno = (expr) }; struct check_positive##testno { int a[test##testno]; };
15
11
int x ;
@@ -52,9 +48,7 @@ struct s {
52
48
53
49
EVAL_EXPR (19 , ((int )& * (char * )10 == 10 ? 1 : -1 ));
54
50
55
- #ifndef NEW_INTERP
56
51
EVAL_EXPR (20 , __builtin_constant_p (* ((int * ) 10 )));
57
- #endif
58
52
59
53
EVAL_EXPR (21 , (__imag__ 2 i ) == 2 ? 1 : -1 );
60
54
@@ -112,11 +106,9 @@ int intLvalue[*(int*)((long)&n ?: 1)] = { 1, 2 }; // both-error {{variable lengt
112
106
union u { int a ; char b [4 ]; };
113
107
char c = ((union u )(123456 )).b [0 ]; // both-error {{not a compile-time constant}}
114
108
115
- #ifndef NEW_INTERP
116
109
extern const int weak_int __attribute__((weak ));
117
110
const int weak_int = 42 ;
118
111
int weak_int_test = weak_int ; // both-error {{not a compile-time constant}}
119
- #endif
120
112
121
113
int literalVsNull1 = "foo" == 0 ;
122
114
int literalVsNull2 = 0 == "foo" ;
@@ -125,10 +117,8 @@ int literalVsNull2 = 0 == "foo";
125
117
int castViaInt [* (int * )(unsigned long )"test" ]; // both-error {{variable length array}}
126
118
127
119
// PR11391.
128
- #ifndef NEW_INTERP
129
120
struct PR11391 { _Complex float f ; } pr11391 ;
130
121
EVAL_EXPR (42 , __builtin_constant_p (pr11391 .f = 1 ))
131
- #endif
132
122
133
123
// PR12043
134
124
float varfloat ;
0 commit comments