www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 7063] New: No error or warning for conflicting D and C symbols

reply d-bugmail puremagic.com writes:
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



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: -------
Dec 03 2011
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=7063




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: -------
Dec 03 2011
prev sibling next sibling parent d-bugmail puremagic.com writes:
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



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: -------
Oct 21 2012
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=7063




15:40:22 PDT ---

 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: -------
Oct 21 2012