[Issue 23018] New: importC: syntax error for sizeof with postfix operator on parenthesized expression

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Apr 15 19:39:33 UTC 2022


https://issues.dlang.org/show_bug.cgi?id=23018

          Issue ID: 23018
           Summary: importC: syntax error for sizeof with postfix operator
                    on parenthesized expression
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Keywords: ImportC, rejects-valid
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: duser at neet.fi
                CC: duser at neet.fi

int xs[1];
struct { int x; } s, *sp;
int fn(void);
int i;
_Static_assert( sizeof (xs)[0] == sizeof(int), "" );
_Static_assert( sizeof (sp)->x == sizeof(int), "" );
_Static_assert( sizeof (s).x == sizeof(int), "" );
_Static_assert( sizeof (fn)() == sizeof(int), "" );
_Static_assert( sizeof (i)++ == sizeof(int), "" );

all give a syntax error

they should be parsed the same as "sizeof( (xs)[0] )" and so on (topmost level
of parens omitted)

--


More information about the Digitalmars-d-bugs mailing list