Bug 954 – Recursive templates with values, Error: T is used as a type

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D1 (retired)
Platform
x86
OS
All
Creation time
2007-02-12T07:19:00Z
Last change time
2014-02-16T15:22:54Z
Keywords
rejects-valid
Assigned to
bugzilla
Creator
lio+bugzilla

Comments

Comment #0 by lio+bugzilla — 2007-02-12T07:19:15Z
template Foo( char C ) { const Foo = true; } template Bar(char[] T, int F ) { const Bar = Foo!(T[F]); //line 7 } static assert( Bar!("asd",1) ); Results in: t.d(7): Error: T is used as a type t.d(7): template instance Foo!(void[1]) does not match any template declaration t.d(7): variable t.Bar!("asd",1).Bar voids have no value Workaround: change the reference to F in that line to "F+0"
Comment #1 by lio+bugzilla — 2007-02-12T07:21:27Z
Forgot to emphasize: direct references to T[F] work fine, for example: template Foo(char[] T, int F) { const Foo = T[F]; }
Comment #2 by thomas-dloop — 2007-04-06T06:29:13Z
Comment #3 by lio+bugzilla — 2009-03-08T20:54:31Z
This seems to have been fixed in version 1.030