Thread overview
[Issue 2246] New: specialization of template to template containing int arguments fails
Jul 25, 2008
d-bugmail
Jul 25, 2008
d-bugmail
Jul 26, 2008
Bill Baxter
[Issue 2246] Regression(2.046, 1.061): Specialization of template to template containing int arguments fails
Nov 26, 2010
Don
Aug 04, 2011
Kenji Hara
Aug 05, 2011
Walter Bright
Aug 06, 2011
Walter Bright
July 25, 2008
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


-- 

July 25, 2008
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.


-- 

July 26, 2008
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
November 26, 2010
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: -------
August 04, 2011
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


--- Comment #3 from Kenji Hara <k.hara.pg@gmail.com> 2011-08-04 12:51:32 PDT ---
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: -------
August 05, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=2246


Walter Bright <bugzilla@digitalmars.com> changed:

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


--- Comment #4 from Walter Bright <bugzilla@digitalmars.com> 2011-08-04 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: -------
August 06, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=2246


Walter Bright <bugzilla@digitalmars.com> changed:

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


--- Comment #5 from Walter Bright <bugzilla@digitalmars.com> 2011-08-06 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: -------