[Issue 22259] New: importC: Redundant declarations of extern variables fail to compile.
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Wed Sep 1 00:58:21 UTC 2021
https://issues.dlang.org/show_bug.cgi?id=22259
Issue ID: 22259
Summary: importC: Redundant declarations of extern variables
fail to compile.
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
The following c program fails to compile.
// extern.c
extern char something;
extern char something;
int main(void){
return 0;
}
The following error is reported:
extern.c(2): Error: variable `extern.something` conflicts with variable
`extern.something` at extern.c(1)
Redundant declarations of extern variables is legal in C.
On macOS, extern char* suboptarg is declared in both unistd.h and stdlib.h.
Thus if you have a header that includes both (like Python.h), the program fails
to compile.
--
More information about the Digitalmars-d-bugs
mailing list