[Issue 3538] Default value of alias template parameter is instantiated only once.

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Mon Feb 1 05:07:41 PST 2016


https://issues.dlang.org/show_bug.cgi?id=3538

aneas <alexander.breckel at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
                 CC|                            |alexander.breckel at gmail.com
         Resolution|FIXED                       |---

--- Comment #3 from aneas <alexander.breckel at gmail.com> ---
This problem still exists, if the default expression is not a type, but an
actual expression referring to a type:

template Tpl(T, alias S = "" ~ T.stringof) {
    pragma(msg, S);
}
class A { }
class B { }
alias TA = Tpl!A;
alias TB = Tpl!B;

I think a possible solution would be to always use a syntaxCopy() of
defaultAlias. How would this affect performance?

--


More information about the Digitalmars-d-bugs mailing list