www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 565] New: Cannot forward reference types within template parameter list

reply d-bugmail puremagic.com writes:

           Summary: Cannot forward reference types within template parameter
           Product: D
           Version: 0.174
          Platform: PC
               URL: http://www.digitalmars.com/d/template.html
        OS/Version: Windows
            Status: NEW
          Keywords: rejects-valid, spec
          Severity: major
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla digitalmars.com
        ReportedBy: deewiant gmail.com
OtherBugsDependingO 511

In the spec, under "Argument Deduction", the following example is given:

template TBar(D : E*, E) { }
alias TBar!(int*, int) Bar3;    // (1) E is int
                                // (3) D is int*

This does, however, not compile:

asdf.d(1): Error: identifier 'E' is not defined
asdf.d(1): Error: E is used as a type

Another similar example is used later in the same section:

class A { }
class B : A { }

template TBar(T : U*, U : A) { }
alias TBar!(B*, B) Foo5;        // (2) T is B*
                                // (3) U is B

I'd say this is a DMD bug since it's evidently expected to work.

Nov 18 2006
parent d-bugmail puremagic.com writes:

davidl 126.com changed:

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

------- Comment #1 from davidl 126.com  2007-06-12 11:15 -------
Fixed at least in dmd 1.014
earlier version not tested yet

Jun 12 2007