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






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 next 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



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
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2246


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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |patch
                 CC|                            |k.hara.pg gmail.com



D2 patch:
https://github.com/D-Programming-Language/dmd/pull/293

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Aug 04 2011
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2246


Walter Bright <bugzilla digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bugzilla digitalmars.com



22:59:24 PDT ---
https://github.com/D-Programming-Language/dmd/commit/4a1c9e7646ed9152f9644cd29d07968583888cb2

https://github.com/D-Programming-Language/dmd/commit/d46025200085f837df95161dfe79153c07d761f2

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Aug 04 2011
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2246


Walter Bright <bugzilla digitalmars.com> changed:

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



00:01:15 PDT ---
https://github.com/D-Programming-Language/dmd/commit/4a1c9e7646ed9152f9644cd29d07968583888cb2

https://github.com/D-Programming-Language/dmd/commit/d46025200085f837df95161dfe79153c07d761f2

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Aug 06 2011