Opened 4 years ago

Last modified 4 years ago

#184 new defect

Struct in forall cannot have member named same as an assertion

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

Description (last modified by mlbrooks)

Code:

forall ( dtype T | { int x; } ) {
    struct S {
      #ifndef NOBUG
        int x;
      #endif
    };
    void ?{}( S(T) & ) {
        printf("%d\n", x);
    }
}

int main() {
    int x = 37;
    printf("%d\n", x);

    S(float) s;
}

Expect: Plain compile succeeds and runs with output

37
37

Actual a: Plain compile fails with

error: duplicate object definition for x: signed int

Actual b: Compile -DNOBUG behaves as expected for plain.

Note that the type parameter on S is not used. It's included as a workaround for #185.

Change History (1)

comment:1 Changed 4 years ago by mlbrooks

Description: modified (diff)
Note: See TracTickets for help on using tickets.