www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 3116] New: cannot use basic types as template alias parameters

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

           Summary: cannot use basic types as template alias parameters
           Product: D
           Version: 1.045
          Platform: Other
        OS/Version: Linux
            Status: NEW
          Keywords: rejects-valid, spec
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: kamm-removethis incasoftware.de


The spec says template alias parameters accept type names, but basic types
don't work:

template T(alias a) { }
alias T!(int) ti; // error: does not match
alias T!(float) tf; // error: does not match
alias T!(Object) to; // ok

This seems to be because Type::toDsymbol returns NULL.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jun 30 2009
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3116


Walter Bright <bugzilla digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bugzilla digitalmars.com
           Platform|Other                       |All
         OS/Version|Linux                       |All
           Severity|normal                      |enhancement




--- Comment #1 from Walter Bright <bugzilla digitalmars.com>  2009-07-03
12:57:31 PDT ---
Basic types are keywords, not names. This is an enhancement request.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jul 03 2009
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3116


Jarrett Billingsley <jarrett.billingsley gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jarrett.billingsley gmail.c
                   |                            |om




--- Comment #2 from Jarrett Billingsley <jarrett.billingsley gmail.com> 
2009-07-03 13:01:52 PDT ---
If template alias parameters are to act consistently with aliases, then it
should "just work".

alias int X; // fine
alias X Y; // fine

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jul 03 2009
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3116


Christian Kamm <kamm-removethis incasoftware.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|rejects-valid               |
            Summary|cannot use basic types as   |clarify which type names
                   |template alias parameters   |are valid template alias
                   |                            |parameters
           Severity|enhancement                 |normal




--- Comment #3 from Christian Kamm <kamm-removethis incasoftware.de> 
2009-07-04 00:18:52 PDT ---
In that case I withdraw this enhancement request and rather ask that the D1
spec be clarified (where is 'type names' and 'D symbol' defined?). 

Would the following replacements in the "Template Alias Parameters" section be
correct?

typedef names -> enum, typedef, struct or class names (in the list of valid
arguments)
type names -> class names (in the example)

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jul 04 2009