August 24 [Issue 24718] New: [ImportC] typedef struct with name as a pointer cannot be used with struct name | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=24718 Issue ID: 24718 Summary: [ImportC] typedef struct with name as a pointer cannot be used with struct name Product: D Version: D2 Hardware: All OS: All Status: NEW Keywords: ImportC Severity: normal Priority: P1 Component: dmd Assignee: nobody@puremagic.com Reporter: schveiguy@gmail.com imported.c: typedef struct Foo { int x; } *pFoo; struct Bar { struct Foo foo; }; main.d: import imported; Compiling main.d fails to build with the following message: imported.c(6): Error: variable `testimportc.Bar.foo` - no definition of struct `Foo` imported.c(6): see https://dlang.org/spec/struct.html#opaque_struct_unions imported.c(6): perhaps declare a variable with pointer type `Foo*` instead Actually compiling imported.c with the D compiler succeeds! Note that it *requires* a typedef to a pointer, with a struct name. Removing the pointer, it works. Removing the typedef, it works. Note that I discovered this on a Mac via ldc, but I believe this is not limited to those. -- |
Copyright © 1999-2021 by the D Language Foundation