[Issue 1515] compiler accepts invalid template declaration
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Mon Oct 29 05:52:38 PDT 2007
http://d.puremagic.com/issues/show_bug.cgi?id=1515
smjg at iname.com changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |smjg at iname.com
------- Comment #1 from smjg at iname.com 2007-10-29 07:52 -------
AIUI this is by design, though admittedly it's a rather strange design.
http://www.digitalmars.com/d/1.0/template.html
template TBar(T : T*) { }
alias TBar!(char*) Foo3; // (2) T is deduced to be char
Basically, what it means is that if a template parameter name is re-used as
part of the specialization, it has the meaning of 'anything', and within the
template, the identifier denotes what it represented within the specialization.
But where T is used as a template parameter in the specialization, I'm not sure
it can work in the general case. After all, there's a potential infinitude of
templates to instantiate to try to find a match. So I'm still not sure that
the compiler should accept the template declaration.
--
More information about the Digitalmars-d-bugs
mailing list