Thread overview | ||||||
---|---|---|---|---|---|---|
|
November 14, 2020 presence of function template prevents diagnostic | ||||
---|---|---|---|---|
| ||||
~~~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, 2020 Re: presence of function template prevents diagnostic | ||||
---|---|---|---|---|
| ||||
Posted in reply to kdevel | 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, 2020 Re: presence of function template prevents diagnostic | ||||
---|---|---|---|---|
| ||||
Posted in reply to Steven Schveighoffer | 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, 2020 Re: presence of function template prevents diagnostic | ||||
---|---|---|---|---|
| ||||
Posted in reply to Max Haughton | On Monday, 16 November 2020 at 18:34:14 UTC, Max Haughton wrote:
> [...] Probably should be a bug.
filed as Issue 21481
|
Copyright © 1999-2021 by the D Language Foundation