Opened 6 years ago
Closed 3 years ago
#142 closed defect (fixed)
constant expression problem
Reported by: | pabuhr | Owned by: | |
---|---|---|---|
Priority: | major | Component: | cfa-cc |
Version: | 1.0 | Keywords: | |
Cc: |
Description
The following works with gcc but fails with CFA.
struct S { int i; }; enum { X = sizeof(struct S) }; int x[X]; cfa test5.cfa CFA Version 1.0.0 (debug) test5.cfa:4:1 error: Non-constexpr in initialization of enumerator: X: const instance of enum __anonymous0 with body 1 with initializer (not constructed) Simple Initializer: Generated Cast of: Sizeof Expression on: instance of struct S with body 1 ... to: signed int ... with environment: Types: Non-types:
Note: See
TracTickets for help on using
tickets.
This might be an easy fix. I would trace through
ConstExprChecker
and see what it's doing with this expression. Reading the code, I would have thought it would work, but maybe there's a hiddenTypeExpr
here? ApparentlyTypeExpr
doesn't print any extra prefix (seeTypeExpr::print
), it might be worth adding one there to prevent confusion in the future.