[Issue 22886] New: ImportC: forward declaration of struct in a function prototype leads to "redeclaration with different type" error.
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Thu Mar 17 08:27:44 UTC 2022
https://issues.dlang.org/show_bug.cgi?id=22886
Issue ID: 22886
Summary: ImportC: forward declaration of struct in a function
prototype leads to "redeclaration with different type"
error.
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Keywords: ImportC, rejects-valid
Severity: normal
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: dave287091 at gmail.com
The following C code fails to compile:
// test.c
struct config *Configlist_add(int);
struct config *Configlist_add(int x){ // Error: function `test.Configlist_add`
redeclaration with different type
return 0;
}
struct config {
int dot;
};
Strangely, if the function takes no arguments there is no error. If you forward
declare the struct at the top of the file, there is no error.
--
More information about the Digitalmars-d-bugs
mailing list