www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 22106] New: importC: Error: variable 'var' no definition of


          Issue ID: 22106
           Summary: importC: Error: variable 'var' no definition of struct
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: critical
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: ibuclaw gdcproject.org

Occurs when a struct is defined as `typedef struct type`, then later used to
declare a variable with `struct type` instead of its typedef'd name.
typedef struct S
  int field;
} S_t;

struct T
  struct S f1;   // NG -> errors !!!
  S_t f2;        // OK -> compiles
  struct S_t f3; // OK -> errors

int main()
  struct S var;   // NG -> errors !!!
  return 0;

Jul 06 2021