Thread overview
presence of function template prevents diagnostic
Nov 14
kdevel
Dec 14
kdevel
November 14
~~~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?
November 16
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
November 16
On Monday, 16 November 2020 at 17:03:32 UTC, Steven Schveighoffer wrote:
> 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

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.
December 14
On Monday, 16 November 2020 at 18:34:14 UTC, Max Haughton wrote:
> [...] Probably should be a bug.

filed as Issue 21481