[Issue 14719] Template instantiation parsed as C-style type cast

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Mon Jun 22 03:56:39 PDT 2015


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

Kenji Hara <k.hara.pg at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |INVALID

--- Comment #1 from Kenji Hara <k.hara.pg at gmail.com> ---
(In reply to Yuxuan Shui from comment #0)
> (a!A)!B
>
> Which is parsed as a C-style cast.

It's not a bug. The code is parsed as:

(a!A)    // a type name a!A with parenthesis
!        // unary operator !
B        // an identifier B

so `(typename) expr` makes a C-style cast.

To do what you want, you need to write:

alias aA = a!A;
aA!B

--


More information about the Digitalmars-d-bugs mailing list