[Bug 144] New: Alias and function names fail to collide

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed May 17 17:10:40 PDT 2006


http://d.puremagic.com/bugzilla/show_bug.cgi?id=144

           Summary: Alias and function names fail to collide
           Product: D
           Version: 0.156
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla at digitalmars.com
        ReportedBy: shro8822 at uidaho.edu


When a function and an alias have the same name, DMD fails to produce an error
unless the function is used directly. Taking the address off the name give no
error.

In the following test case the function (not the alias) is arbitrarily picked,
however it is also the first definition and if this follows the pattern set in
bug #52, reversing the order of the definitions will change this (not checked).

Test case:
-------------
void fn(){assert(0);}   // make a function

void gm(){assert(0);}   // make another function

alias gm fn;            // alias the second with the name of the first

void main()
{                       // make pointer-to-function from name
        void function() fnp = & fn;
                        // call pointer-to-function
        fnp();

        // fn();        // wont compile with this line included
}
-------------


-- 




More information about the Digitalmars-d-bugs mailing list