www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 12213] New: DMD accepts invalid alias declaration

reply d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=12213

           Summary: DMD accepts invalid alias declaration
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: brian-schott cox.net



template X(string a, string b) {}
alias Y(string b) = X!("a", b);

No part of the language specification says that this is valid. DMD seems to be
accepting "alias" where "enum" is the correct keyword to use.

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 20 2014
parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=12213


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

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



template X(string a, string b) {}
alias Y(string b) = X!("a", b);

The alias declaration is equivalent with:

template Y(string b)
{
    alias Y = X!("a", b);
}

This is a new feature from 2.064, which had been proposed as DIP42.

http://wiki.dlang.org/DIP42

And the feature will be finally documented in 2.065 release.

https://github.com/D-Programming-Language/dlang.org/pull/371

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 20 2014