Opened 3 months 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:
Cc:

Description

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

                                struct thing {
#ifdef VARIATION_PRINTING_CTOR
                                    helper h;
#endif

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

                                int main() {
                                    thing x, y;
#ifdef VARIATION_ASSIGN
                                    x = y;
#endif
                                    printf("done\n");
                                }

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"
-DVARIATION_PRINTING_CTOR, -DDECL_NO_VOLATILE: same
-DDECL_NO_ARRAY:                               makes successfully; prints "done"
-DDECL_NO_VOLATILE:                            same
-DDECL_NO_ARRAY -DVARIATION_ASSIGNL            same
-DDECL_NO_VOLATILE -DVARIATION_ASSIGN:         same

Change History (0)

Note: See TracTickets for help on using tickets.