www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 13896] New: DMD-FE accepts multiple extern(C) definitions

https://issues.dlang.org/show_bug.cgi?id=13896

          Issue ID: 13896
           Summary: DMD-FE accepts multiple extern(C) definitions
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: DMD
          Assignee: nobody puremagic.com
          Reporter: alphaglosined gmail.com

Multiple extern(C) definitions not throwing an error.
http://forum.dlang.org/post/m6m5tc$2c4d$1 digitalmars.com

Example:
https://github.com/nomad-software/x11/blob/160f5109cb9f09ab69f9a16c685c5a6b39179db6/source/x11/Xlib.d#L1534

extern Window XCreateWindow(
    Display*                                            /* display             
                                        */,
    Window                                              /* parent              
                                        */,
    int                                                 /* x                   
                                        */,
    int                                                 /* y                   
                                        */,
    uint                                                /* width               
                                        */,
    uint                                                /* height              
                                        */,
    uint                                                /* border_width        
                                        */,
    int                                                 /* depth               
                                        */,
    uint                                                /* class               
                                        */,
    Visual*                                             /* visual              
                                        */,
    c_ulong                                             /* valuemask           
                                        */,
    XSetWindowAttributes*                               /* attributes          
                                        */
);
/++
 + Create windows and window attributes structure.
 +
 + This overload allow you to pass the special parameter "CopyFromParent".
 + Watch out as it will accept any kind of XID, hence it is not type safe.
 +/
extern Window XCreateWindow(Display* display, Window   parent,
                            int x, int y, uint width, uint height,
                            uint border_width, int depth, uint _class,
                            XID copyFromParent, c_ulong  valuemask,
                            XSetWindowAttributes* attributes);

Ldc catches this, gdc and dmd do not. Tested on Windows, Linux 2.065 and
2.066.1.

--
Dec 26 2014