mirror of
https://github.com/dlang/dmd.git
synced 2025-04-27 21:51:03 +03:00
ImportC: allow imports from multiple C files (#14457)
This commit is contained in:
parent
8d76134534
commit
194182a9c8
4 changed files with 12 additions and 0 deletions
|
@ -1544,6 +1544,12 @@ public:
|
||||||
|
|
||||||
if (flags & IgnoreAmbiguous) // if return NULL on ambiguity
|
if (flags & IgnoreAmbiguous) // if return NULL on ambiguity
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
|
/* If two imports from C import files, pick first one, as C has global name space
|
||||||
|
*/
|
||||||
|
if (s.isCsymbol() && s2.isCsymbol())
|
||||||
|
continue;
|
||||||
|
|
||||||
if (!(flags & IgnoreErrors))
|
if (!(flags & IgnoreErrors))
|
||||||
ScopeDsymbol.multiplyDefined(loc, s, s2);
|
ScopeDsymbol.multiplyDefined(loc, s, s2);
|
||||||
break;
|
break;
|
||||||
|
|
4
compiler/test/compilable/cimports2.i
Normal file
4
compiler/test/compilable/cimports2.i
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
__import imports.cimports2a;
|
||||||
|
__import imports.cimports2b;
|
||||||
|
|
||||||
|
int *p = &xx;
|
1
compiler/test/compilable/imports/cimports2a.i
Normal file
1
compiler/test/compilable/imports/cimports2a.i
Normal file
|
@ -0,0 +1 @@
|
||||||
|
extern int xx;
|
1
compiler/test/compilable/imports/cimports2b.i
Normal file
1
compiler/test/compilable/imports/cimports2b.i
Normal file
|
@ -0,0 +1 @@
|
||||||
|
extern int xx;
|
Loading…
Add table
Add a link
Reference in a new issue