Mission impossible

Shachar Shemesh shachar at weka.io
Wed Apr 11 08:59:36 UTC 2018


On 11/04/18 11:51, Uknown wrote:
> On Wednesday, 11 April 2018 at 08:47:12 UTC, Basile B. wrote:
>> On Wednesday, 11 April 2018 at 08:36:41 UTC, Shachar Shemesh wrote:
>>> struct S {
>>>     static void func(T)(uint a, T t) {
>>>     }
>>>
>>>     static void func() {
>>>     }
>>> }
>>>
>>> Your mission, Jim, should you choose to accept it, is this:
>>>
>>> Get a pointer to the version of the function that accepts no arguments.
>>>
>>> As always, should you or any of your Force be caught or killed, the 
>>> Secretary will disavow any knowledge of your actions. This disc will 
>>> self-destruct in ten seconds.
>>>
>>> Good luck, Jim.
>>
>> I suppose __traits(getOverloads) doesn't work because of a bug ?
> 
> The template hides any other overloads that func() has:

IF it is defined before it. If it is defined after it, it does not (but 
it is then possible that the non-template version hides the template one).

The problem is that S has two members called "func". One is a function, 
and the other is a template. "getOverloads" is not built to distinguish 
between the two.

> I'm not sure if its a bug though

What else is it?

Shachar


More information about the Digitalmars-d mailing list