digitalmars.D.bugs - Duplicated function with alias
- Roberto Mariottini (39/39) May 27 2005 Hi,
- =?UTF-8?B?VGhvbWFzIEvDvGhuZQ==?= (5/36) Jun 04 2005 Known DMD bug:
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/
May 27 2005
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
Jun 04 2005








=?UTF-8?B?VGhvbWFzIEvDvGhuZQ==?=