Skip to content

Parser: crashing invalid constructs

Bas van den Berg edited this page May 24, 2020 · 3 revisions

This is a list of language construct that cause the compiler to fail. This can be crashes or just asserts() because of a feature is not yet implemented.

MemberExpr analysis

a.getB().getC().cStructFunc()

should work, but gives invalid error. Need better analysis of MemberExpr

Substruct/union initialization

type Value struct {
   u32 id;
   union {
       i32 number;
       const char* text;
   }
}
Value v1 = { .number = 10 }  // should work
Value v2 = { 10, .num = 10 } // should work
Value v3 = { 20, .text = "hello" } // should work
  • allow initializing any (one) member of a union
  • c currently allows this as well.
  • TBD: when not to allow mixing designated init operators and undesignated ones?
Clone this wiki locally