https://issues.dlang.org/show_bug.cgi?id=22332
Issue ID: 22332
Summary: ImportC: declarations in imported C files conflict
with D declarations.
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Severity: normal
Priority: P1
Component: dmd
Assignee: [email protected]
Reporter: [email protected]
When a D file imports a preprocessed c file, there are likely going to be
symbols declared in both D and in C when using c standard headers. For example:
// stdio.i
int printf(const char * restrict, ...) __attribute__((__format__ (__printf__,
1, 2)));
// hello.d
import stdio;
import core.stdc.stdio;
void main(){
printf("Hello world\n”);
}
Compiling hello.d results in the following error:
hello.d(5): Error: function `core.stdc.stdio.printf` at
.../core/stdc/stdio.d/stdio.d(1274) conflicts with function `stdio.printf` at
stdio.i(1)
As the probability of such a conflict in a project is very high, these
conflicts need to be resolved somehow.
--