May 18, 2006 [Bug 144] New: Alias and function names fail to collide | ||||
---|---|---|---|---|
| ||||
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@digitalmars.com ReportedBy: shro8822@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 } ------------- -- |
May 19, 2006 Re: [Bug 144] New: Alias and function names fail to collide | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail Attachments: | d-bugmail@puremagic.com schrieb am 2006-05-18: > 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). Added to DStress as http://dstress.kuehne.cn/nocompile/a/alias_35_A.d http://dstress.kuehne.cn/nocompile/a/alias_35_B.d http://dstress.kuehne.cn/nocompile/a/alias_35_C.d http://dstress.kuehne.cn/nocompile/a/alias_35_D.d http://dstress.kuehne.cn/nocompile/a/alias_35_E.d http://dstress.kuehne.cn/nocompile/a/alias_35_F.d Thomas |
Copyright © 1999-2021 by the D Language Foundation