digitalmars.D.bugs - Duplicated function with alias
- Roberto Mariottini <Roberto_member pathlink.com> May 27 2005
- =?UTF-8?B?VGhvbWFzIEvDvGhuZQ==?= Jun 04 2005
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
Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit 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==?=