[Issue 22260] New: importC: Error: struct `foo.Foo` no size because of forward reference

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Sep 1 04:07:30 UTC 2021


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 at puremagic.com
          Reporter: dave287091 at 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.

--


More information about the Digitalmars-d-bugs mailing list