www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 2246] New: specialization of template to template containing int arguments fails

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

           Summary: specialization of template to template containing int
                    arguments fails
           Product: D
           Version: 1.024
          Platform: Macintosh
        OS/Version: Mac OS X
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla digitalmars.com
        ReportedBy: fawzi gmx.ch


{{{
class A(T,d){
    T p;
}

class B(int rk){
    int[rk] p;
}

class C(T,int rk){
    T[rk] p;
}

template f(T:A!(U,d),U,d){
    void f(){ }
}

template f(T:B!(rank),int rank){
    void f(){ }
}

template f(T:C!(U,rank),U,int rank){
    void f(){ }
}

void main(){
    A!(int,long) a;
    B!(2) b;
    C!(int,2) c;
    f!(A!(int,long))();
    f!(B!(2))();
    f!(C!(int,2))();
}
}}}

fails on 
    f!(B!(2))();
and
    f!(C!(int,2))();

{{{
Line 30: template instance f!(B) does not match any template declaration
Line 30: Error: template instance 'f!(B)' is not a variable
Line 30: Error: function expected before (), not f!(B) of type int
}}}

also GDC, and (i suspect) newer DMD releases have this problem 

Fawzi


-- 
Jul 25 2008
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2246





------- Comment #1 from fawzi gmx.ch  2008-07-25 12:05 -------
I think (I did not try all possibilities, but most) that this extends to any
non type arguments.


-- 
Jul 25 2008
prev sibling next sibling parent Bill Baxter <dnewsgroup billbaxter.com> writes:
d-bugmail puremagic.com wrote:
 http://d.puremagic.com/issues/show_bug.cgi?id=2246
 
            Summary: specialization of template to template containing int
                     arguments fails
            Product: D
            Version: 1.024
           Platform: Macintosh
         OS/Version: Mac OS X
             Status: NEW
           Keywords: rejects-valid
           Severity: normal
           Priority: P2
          Component: DMD
         AssignedTo: bugzilla digitalmars.com
         ReportedBy: fawzi gmx.ch
 
 
 {{{
 class A(T,d){
     T p;
 }
 
 class B(int rk){
     int[rk] p;
 }
 
 class C(T,int rk){
     T[rk] p;
 }
 
 template f(T:A!(U,d),U,d){
     void f(){ }
 }
 
 template f(T:B!(rank),int rank){
     void f(){ }
 }
 
 template f(T:C!(U,rank),U,int rank){
     void f(){ }
 }
 
 void main(){
     A!(int,long) a;
     B!(2) b;
     C!(int,2) c;
     f!(A!(int,long))();
     f!(B!(2))();
     f!(C!(int,2))();
 }
 }}}
 
 fails on 
     f!(B!(2))();
 and
     f!(C!(int,2))();
 
 {{{
 Line 30: template instance f!(B) does not match any template declaration
 Line 30: Error: template instance 'f!(B)' is not a variable
 Line 30: Error: function expected before (), not f!(B) of type int
 }}}
 
 also GDC, and (i suspect) newer DMD releases have this problem 
 
 Fawzi
 
 

There was a related-sounding bug fixed in the last 1.x release. Have you tried it there (1.033 I think)? --bb
Jul 25 2008
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2246


Don <clugdbug yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |clugdbug yahoo.com.au
           Platform|PowerPC                     |All
            Summary|specialization of template  |Regression(2.046, 1.061):
                   |to template containing int  |Specialization of template
                   |arguments fails             |to template containing int
                   |                            |arguments fails
         OS/Version|Mac OS X                    |All
           Severity|normal                      |regression


--- Comment #2 from Don <clugdbug yahoo.com.au> 2010-11-26 01:16:51 PST ---
The code actually worked for a long time, but was broken again in 2.046.
Possibly caused by the bugfix for bug 945.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Nov 26 2010