www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 22260] New: importC: Error: struct `foo.Foo` no size because

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

          Issue ID: 22260
           Summary: importC: Error: struct `foo.Foo` no size because of
                    forward reference
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: major
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: dave287091 gmail.com

Given the following C code:

struct Foo* foo(void);

typedef struct Foo {
    int x;
} Foo;

foo.c(1): Error: struct `foo.Foo` no size because of forward reference

The compiler then segfaults.

Interestingly, changing it to 

struct Foo* foo(void);

struct Foo {
    int x;
} Foo;

Has the same behavior.

--
Aug 31 2021