[Issue 15464] Template parameter-dependent attributes
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Wed Dec 23 00:00:04 PST 2015
https://issues.dlang.org/show_bug.cgi?id=15464
--- Comment #5 from Daniel Kozak <kozzi11 at gmail.com> ---
(In reply to Kenji Hara from comment #4)
> (In reply to Andrei Alexandrescu from comment #0)
> > Per Timon Gehr's reply, implementation could achieved the feature by means of a lowering.
>
> A function template declaration:
>
> void foo(T)() @attr(T.field) {}
>
> Is now lowered to:
>
> @attr(T.field) template foo(T) { void foo() {} }
>
> So, as Timon said, if we change the lowered form as follows, it will support
> the enhancement naturally.
>
> template foo(T) { void foo() @attr(T.field) {} }
>
>
> However, I have some questions about the corner cases in the change.
> ...
> ----
My current PR affects only postfix udas, so
@uda(T.field) void f(T)(){} still does not compile and will have same behaviour
as before.
So only postfix UDAs change and break, this can be maybe avoid if this new
lowering will be applied only to UDAs with templates parametrs.
The biggest problem I see here is consistency
--
More information about the Digitalmars-d-bugs
mailing list