[Issue 10183] Eponymous template instance fails to match in parameter list of other templates

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon May 27 04:58:32 PDT 2013


http://d.puremagic.com/issues/show_bug.cgi?id=10183


Kenji Hara <k.hara.pg at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |INVALID


--- Comment #2 from Kenji Hara <k.hara.pg at gmail.com> 2013-05-27 04:58:31 PDT ---
(In reply to comment #0)
> Code:
> ----
> struct A(T, Unused)
> {
>     T t;
> }
> 
> template B(T)
> {
>     alias B = A!(T, void);
> }
> 
> void foo(T)(A!T a) {}

The pattern A!T means that the template A has _exactly_ one type template
argument.

> void main()
> {
>     auto b = B!int(42); // OK, works
> 
>     foo(b); // NG - causes error

But the type of b is A!(int, void), so it does not match to A!T during IFTI.

> }

In this case, template function foo should have following signature.

void foo(TL...)(A!TL a) {}
// TL would be deduced to (int, void)

or

void foo(T, TL...)(A!(T, TL) a) {}
// T would be deduced to int
// TL would be deduced to (void)

-- 
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