Thread overview
[Issue 7063] New: No error or warning for conflicting D and C symbols
Dec 03, 2011
Peter Alexander
Dec 03, 2011
Peter Alexander
Oct 21, 2012
Andrej Mitrovic
Oct 21, 2012
Peter Alexander
December 03, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=7063

           Summary: No error or warning for conflicting D and C symbols
           Product: D
           Version: D2
          Platform: x86
        OS/Version: Mac OS X
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody@puremagic.com
        ReportedBy: peter.alexander.au@gmail.com


--- Comment #0 from Peter Alexander <peter.alexander.au@gmail.com> 2011-12-03 15:27:20 PST ---
If you have a D symbol that mangles to the same name as a C symbol you receive no warnings or errors and your program silently exhibits incorrect behaviour:

import std.stdio;

extern(C) void D4test3fooFZv() { writeln(1); }
void foo() { writeln(2); }

void main()
{
    D4test3fooFZv();
    foo();
}

For me, this outputs:

1
1

DMD should probably give an error or at least a warning when two symbols conflict like this.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
December 03, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=7063



--- Comment #1 from Peter Alexander <peter.alexander.au@gmail.com> 2011-12-03 15:39:49 PST ---
If it wasn't obvious from the code given above, the module must be named 'test'

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
October 21, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=7063


Andrej Mitrovic <andrej.mitrovich@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |andrej.mitrovich@gmail.com


--- Comment #2 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2012-10-21 14:53:49 PDT ---
How come you're not getting linker errors? I am on win32:

 Error 1: Previous Definition Different : _D4test3fooFZv

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
October 21, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=7063



--- Comment #3 from Peter Alexander <peter.alexander.au@gmail.com> 2012-10-21 15:40:22 PDT ---
(In reply to comment #2)
> How come you're not getting linker errors? I am on win32:
> 
>  Error 1: Previous Definition Different : _D4test3fooFZv

Different linker on Windows vs. OSX.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------