Opened 22 months ago

#270 new defect

No NoCtor

Reported by: pabuhr Owned by:
Priority: minor Component: cfa-cc
Version: 1.0 Keywords:
Cc:

Description

While attempting to create a CFA NoCtor?, I hit a show-stopper bug. Something is generating bad C code that fails. Note, the use of sizeof(T) in a generic type, which may not have been tested before.
<<<
forall( T & | sized(T) )

struct NoCtor? {

char storage[sizeof(T)];

};

forall( T )

void ctor( NoCtor?(T) & t ) { (*(T *)t.storage){}; }

test1.cfa: In function '_X4ctorQ1_0_0_4X16_operator_assignFBD0_BD0BD0X12_constructorFv_BD0X12_constructorFv_BD0BD0X11_destructorFv_BD0Fv_S6NoCtor_BD0_1':
test1.cfa:5:17: error: '_sizeof_Y12T_generic_' undeclared (first use in this function)

5 | char storage[sizeof(T)];

| ~

test1.cfa:5:17: note: each undeclared identifier is reported only once for each function it appears in

Change History (0)

Note: See TracTickets for help on using tickets.