Opened 2 years ago

#244 new defect

Cannot construct a struct with a volatile array member

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


                                struct helper { float x; };
                                void ?{}( helper & ) { printf("ctor\n"); }

                                struct thing {
                                    helper h;

#if defined DECL_NO_ARRAY
                                    volatile float stuff;
#elif defined DECL_NO_VOLATILE
                                    float stuff[16];
                                    volatile float stuff[16]; // doesn't work

                                int main() {
                                    thing x, y;
                                    x = y;

The DECL_ defines change details of the problematic declaration, thereby showing similar declarations that work as expected.

The VARIATION_ defines show different symptoms of the problematic declaration, when it's used in different contexts.

Problematic Actuals:
(no defines): GCC warning: _X12_constructorFv_S5thingS5thing_autogen_1 used but never defined; makes an executable that prints "done"
-DVARIATION_PRINTING_CTOR: linker error: undefined reference to _X12_constructorFv_S5thing_autogen
_1, and others
-DVARIATION_ASSIGN: resolver error: Unique best alternative includes deleted identifier in ?{ thing & }

Expectations for problematic cases: same as for adding -DDECL_NO_ARRAY or -DDECL_NO_VOLATILE

Actuals as Expected:

-DVARIATION_PRINTING_CTOR, -DDECL_NO_ARRAY:    makes successfully; prints ~"ctor, ctor, done"
-DDECL_NO_ARRAY:                               makes successfully; prints "done"
-DDECL_NO_VOLATILE:                            same

Change History (0)

Note: See TracTickets for help on using tickets.