UDAs on templates

Max Samukha maxsamukha at gmail.com
Wed Oct 16 07:05:28 PDT 2013


On Wednesday, 16 October 2013 at 13:38:44 UTC, Dicebot wrote:
> On Wednesday, 16 October 2013 at 13:24:59 UTC, Max Samukha 
> wrote:
>> @(1)
>> template Foo(T : int) {}
>>
>> @(2)
>> template Foo(T : short) {}
>>
>> __traits(getAttributes, Foo) == ?
>>
>> The current semantics seems quite reasonable.
>
> @(1)
> void foo(int) {}
>
> @(2)
> void foo(double) {}
>
> pragma(msg, __traits(getAttributes, foo));
>
> void main() {}
>
> // Compilation output:
> //
> // tuple(1)

That sucks. Then, getAttributes (and other traits dealing with 
overload sets) should return an empty set, a union or accept a 
pattern to match against the members of the overload set.


More information about the Digitalmars-d-learn mailing list