[Issue 22073] New: importC: Error: found '.' when expecting ';' following compound literal

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Jun 22 19:49:55 UTC 2021


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

          Issue ID: 22073
           Summary: importC: Error: found '.' when expecting ';' following
                    compound literal
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: major
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: ibuclaw at gdcproject.org

Compound literals are a postfix-expression, and so can be followed by any other
postfix-expression in the statement, as per C11 6.5.2
---
postfix-expression:
   primary-expression
   postfix-expression [ expression ]
   postfix-expression ( argument-expression-list (opt) )
   postfix-expression . identifier
   postfix-expression -> identifier
   postfix-expression ++
   postfix-expression --
   ( type-name ) { initializer-list }
   ( type-name ) { initializer-list , }
---

Reduced test:
---
struct S { int field; };

void test()
{
  (struct S) { 42 }.field = 24;      // valid lvalue, see issue 22072.
  int var = (struct S) { 42 }.field;
}

--


More information about the Digitalmars-d-bugs mailing list