www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 23018] New: importC: syntax error for sizeof with postfix

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 puremagic.com
          Reporter: duser neet.fi
                CC: duser 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)

--
Apr 15 2022