January 09, 2007 Bugs with overloaded variadic functions | ||||
---|---|---|---|---|
| ||||
Two odd bugs import std.stdio; class Foo { this(int i, float f){writef(" Foo(i,f) ");} this(float f) {writef(" Foo(f) ");} } void fn(int i, Foo f...){writef(" fn(i,Foo...) ");} void fn(Foo f...) {writef(" fn(Foo...) ");} void main() { int i = 0; float f = 0; //matches: // Foo(i,f) fn(i,Foo...) fn(i,i,f); // BUG fails with "matches both" error //matches: // Foo(f) fn(i,Foo...) // Foo(i,f) fn(Foo...) fn(i,f); // BUG passes and does match >1 //matches: // Foo(f) fn(Foo...) fn(f); //OK } |
Copyright © 1999-2021 by the D Language Foundation