Thread overview | |||||
---|---|---|---|---|---|
|
September 20, 2005 ambiguous variadic function call not rejected by dmd 0.131 (win32) | ||||
---|---|---|---|---|
| ||||
<code> void f(...){} void f(int i, ...){} void f(int i, int j){} void main(){ f(0, 0); } </code> The call "f(0,0)" matches all three definitions of function f, which should not compile. |
September 20, 2005 Re: ambiguous variadic function call not rejected by dmd 0.131 (win32) | ||||
---|---|---|---|---|
| ||||
Posted in reply to zwang | On Tue, 20 Sep 2005 14:20:52 +0800, zwang wrote: > <code> > void f(...){} > void f(int i, ...){} > void f(int i, int j){} > void main(){ > f(0, 0); > } > </code> > > The call "f(0,0)" matches all three definitions of function f, which should not compile. But using the rules for specialization, the f(0,0) is an exact match so it compiles. -- Derek (skype: derek.j.parnell) Melbourne, Australia 20/09/2005 4:48:28 PM |
September 20, 2005 Re: ambiguous variadic function call not rejected by dmd 0.131 (win32) | ||||
---|---|---|---|---|
| ||||
Posted in reply to zwang | On Tue, 20 Sep 2005 14:20:52 +0800, zwang wrote: > <code> > void f(...){} > void f(int i, ...){} > void f(int i, int j){} > void main(){ > f(0, 0); > } > </code> > > The call "f(0,0)" matches all three definitions of function f, which should not compile. But a more problematic issue is that "f(0, 'a')" fails to compile. test.d(5): function test.f called with argument types: (int,char) matches both: test.f(...) and: test.f(int,int) And I can't work out how to get it to call 'f(int, ...)' if I want to. -- Derek (skype: derek.j.parnell) Melbourne, Australia 20/09/2005 4:58:35 PM |
Copyright © 1999-2021 by the D Language Foundation