Changeset 0edbdb2


Ignore:
Timestamp:
Jul 1, 2022, 5:41:09 PM (2 years ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
ADT, ast-experimental, master, pthread-emulation, qualifiedEnum
Children:
6415549
Parents:
f37d9e7
Message:

add constant expression tests

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tests/enum.cfa

    rf37d9e7 r0edbdb2  
    2424}
    2525
     26// test constant-expressions
     27
     28struct S {
     29    int i;
     30};
     31enum K { P = 3 + 4 };
     32enum Y { W = 9 + (3 && 4 || 7)};
     33int p[W];
     34enum { X = W + -3 + ~1 / 2 * (int)4 + sizeof(struct S) + _Alignof(struct S) || 3 && 5 + (3 ? 1 : 2 ) + __builtin_offsetof(struct S, i ) };
     35int x[X];
     36enum { B = 3 + 4 - 7 * 20 / 34 << 3 >> 4 > 8 < 9 <= 23 >= 42 == 12 != 13  & 4 ^ 2 | 8 + sizeof(struct S) + _Alignof(struct S) };
     37int y[B];
     38enum { J = +3 + -4 / ~20 * ! 0 };
     39int z[J] = { 1, 2, 3 };
     40int aa[41] @= { [3] : 3, [1] : 6 };
     41
    2642//Dummy main
    2743int main(int argc, char const *argv[]) {
Note: See TracChangeset for help on using the changeset viewer.