Is this a bug ?

Steven Schveighoffer via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Jul 12 05:27:20 PDT 2016


On 7/12/16 1:31 AM, Chang Long wrote:
> On Tuesday, 12 July 2016 at 04:38:42 UTC, Chang Long wrote:
>> test.d
>> =========
>> template newType(size_t N){
>>         class NewType
>>         {
>>                 enum Type       = N ;
>>         }
>> }
>>
>
> just find it should be this:
>
> template newType(size_t N){
>         class NewType
>         {
>                 enum Type       = N ;
>         }
>         alias newType = NewType;
> }
>

Just some advice: Name your template NewType, or the class newType, and 
then it will work.

-Steve


More information about the Digitalmars-d-learn mailing list