[Issue 8701] One case of template type deduction
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Thu Sep 20 18:17:36 PDT 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8701
Kenji Hara <k.hara.pg at gmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |INVALID
--- Comment #1 from Kenji Hara <k.hara.pg at gmail.com> 2012-09-20 18:18:33 PDT ---
(In reply to comment #0)
> Is this supposed to work? If the answer is negative, maybe it's a good idea to
> support this:
>
> struct Foo(T) {}
> void bar(Spam, T)(Spam!T y) {}
> void main() {
> Foo!int x;
> bar(x);
> }
Compiler would infer Spam as a template symbol in IFTI, but it is
TemplateTypeParameter. Therefore this doesn't work.
Correct code is here:
struct Foo(T) {}
void bar(alias Spam, T)(Spam!T y) {}
void main() {
Foo!int x;
bar(x);
}
You can receive deduced template symbol by TemplateAliasParamerter. Then all
works.
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list