digitalmars.D.learn - presence of function template prevents diagnostic
- kdevel (28/28) Nov 14 2020 ~~~A.d
- Steven Schveighoffer (4/9) Nov 16 2020 That seems like a bug. It shouldn't be less ambiguous because you
- Max Haughton (5/14) Nov 16 2020 It could be technically kosher because of template lookup but I'm
- kdevel (2/3) Dec 13 2020 filed as Issue 21481
~~~A.d
module A;
import std.stdio;
void bar (int s) { __PRETTY_FUNCTION__.writeln; }
~~~
~~~foo.d
import std.stdio;
import A;
alias bar = A.bar;
version (X) {
void bar (T) (T t) { __PRETTY_FUNCTION__.writeln; }
}
void bar (int s) { __PRETTY_FUNCTION__.writeln; }
void main ()
{
bar (1);
}
~~~
$ dmd -i foo
foo.d(13): Error: foo.bar called with argument types (int)
matches both:
A.d(4): A.bar(int s)
and:
foo.d(9): foo.bar(int s)
$ dmd -version=X -i foo
$ ./foo
void A.bar(int s)
Is the latter behavior intended or a bug?
Nov 14 2020
On 11/14/20 5:44 PM, kdevel wrote:$ dmd -version=X -i foo $ ./foo void A.bar(int s) Is the latter behavior intended or a bug?That seems like a bug. It shouldn't be less ambiguous because you *added* an overload that can also handle it... -Steve
Nov 16 2020
On Monday, 16 November 2020 at 17:03:32 UTC, Steven Schveighoffer wrote:On 11/14/20 5:44 PM, kdevel wrote:It could be technically kosher because of template lookup but I'm not sure if the behaviour is actually specified in the standard. Probably should be a bug.$ dmd -version=X -i foo $ ./foo void A.bar(int s) Is the latter behavior intended or a bug?That seems like a bug. It shouldn't be less ambiguous because you *added* an overload that can also handle it... -Steve
Nov 16 2020
On Monday, 16 November 2020 at 18:34:14 UTC, Max Haughton wrote:[...] Probably should be a bug.filed as Issue 21481
Dec 13 2020








kdevel <kdevel vogtner.de>