May 27, 2005 Duplicated function with alias | ||||
---|---|---|---|---|
| ||||
Hi, with DMD v0.125 on Widows XP: import std.stdio; void print(bool b) { writefln("#B: ", b); } void print(bit b) { writefln("#T: ", b); } int main() { print(true); print(false); } --- testBool.d(15): function testBool.print called with argument types: (bit) matches both: testBool.print(bit) and: testBool.print(bit) testBool.d(16): function testBool.print called with argument types: (bit) matches both: testBool.print(bit) and: testBool.print(bit) If 'bool' is an alias then the error should be the duplicate definition of the function. If 'bool' is a typedef then the program should compile. This reminds me a question: why is 'bool' an alias and not a typedef? Ciao --- http://www.mariottini.net/roberto/ |
June 04, 2005 Re: Duplicated function with alias | ||||
---|---|---|---|---|
| ||||
Posted in reply to Roberto Mariottini Attachments:
| Roberto Mariottini wrote: > Hi, > with DMD v0.125 on Widows XP: > > import std.stdio; > > void print(bool b) > { > writefln("#B: ", b); > } > > void print(bit b) > { > writefln("#T: ", b); > } > > int main() > { > print(true); > print(false); > } > > --- > testBool.d(15): function testBool.print called with argument types: > (bit) > matches both: > testBool.print(bit) > and: > testBool.print(bit) > testBool.d(16): function testBool.print called with argument types: > (bit) > matches both: > testBool.print(bit) > and: > testBool.print(bit) > > If 'bool' is an alias then the error should be the duplicate definition of the function. Known DMD bug: http://dstress.kuehne.cn/nocompile/alias_05.d Use GDC to detect this kind of problems properly. Thomas |
Copyright © 1999-2021 by the D Language Foundation