www.digitalmars.com         C & C++   DMDScript  

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

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

          Issue ID: 22106
           Summary: importC: Error: variable 'var' no definition of struct
                    'type'
           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