Bugs with overloaded variadic functions

BCS ao at pathlink.com
Mon Jan 8 17:19:08 PST 2007


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
}




More information about the Digitalmars-d-bugs mailing list