[Issue 2372] New: Template parameter types given as template parameter inhibits template instantiation
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Wed Sep 24 01:15:27 PDT 2008
http://d.puremagic.com/issues/show_bug.cgi?id=2372
Summary: Template parameter types given as template parameter
inhibits template instantiation
Product: D
Version: 2.019
Platform: PC
OS/Version: Windows
Status: NEW
Keywords: diagnostic, rejects-valid
Severity: major
Priority: P2
Component: DMD
AssignedTo: bugzilla at digitalmars.com
ReportedBy: simen.kjaras at gmail.com
Passing the type of a template parameter as another template parameter causes
errors when compiling. Take the following code:
////
void foo(T, T t)(mystruct!(T, t) bar)
{
}
struct mystruct(T, T t)
{
}
void main()
{
mystruct!(int, 2) baz;
foo(baz);
}
////
Compiling it yields this result:
Error: identifier 'T' is not defined
Error: T is used as a type
foo.d(12): template foo.foo(T,T t) does not match any function template
declarat
ion
foo.d(12): template foo.foo(T,T t) cannot deduce template function from
argument
types !()(mystruct!(int,2))
Note also that the first two messages have no line number.
--
More information about the Digitalmars-d-bugs
mailing list