2246 – Regression(2.046, 1.061): Specialization of template to template containing int arguments fails

D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 2246 - Regression(2.046, 1.061): Specialization of template to template containing int arguments fails
Summary: Regression(2.046, 1.061): Specialization of template to template containing i...
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D1 (retired)
Hardware: All All
: P2 regression
Assignee: No Owner
URL:
Keywords: patch, rejects-valid
Depends on:
Blocks:
Reported: 2008年07月25日 08:30 UTC by Fawzi Mohamed
Modified: 2014年02月24日 15:32 UTC (History)
3 users (show)

See Also:


Attachments
Add an attachment (proposed patch, testcase, etc.)

Note You need to log in before you can comment on or make changes to this issue.
Description Fawzi Mohamed 2008年07月25日 08:30:21 UTC
{{{
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
Comment 1 Fawzi Mohamed 2008年07月25日 12:05:27 UTC
I think (I did not try all possibilities, but most) that this extends to any non type arguments.
Comment 2 Don 2010年11月26日 01:16:51 UTC
The code actually worked for a long time, but was broken again in 2.046. Possibly caused by the bugfix for bug 945.
Comment 3 Kenji Hara 2011年08月04日 12:51:32 UTC
D2 patch:
https://github.com/D-Programming-Language/dmd/pull/293 


AltStyle によって変換されたページ (->オリジナル) /