[Issue 1101] Can't not deduce template correctly

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Apr 9 03:24:16 PDT 2007


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


fvbommel at wxs.nl changed:

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




------- Comment #3 from fvbommel at wxs.nl  2007-04-09 05:24 -------
How about:
=====
Function templates can be explicitly instantiated [snip] or implicitly, where
the TemplateArgumentList is deduced from the types of the function arguments
=====
Note: The *types* of the function arguments, not their values.
IFTI only works for type arguments.

This code is pretty close to yours though:
-----
enum type{
    a,
    b,
}
template XX(uint a, uint c)
{
    uint XX(){ return (a*256+c);}
}

void main()
{
    int k=XX!(type.a,type.b);
}
-----
All in all, a one-character edit is all it took.
(The casts are redundant so I removed them, and the trailing parentheses in
your "workaround" are optional because of property syntax. Both should be fine
if you left them in though)


If you still don't understand what's wrong with your code after reading this, I
suggest you post in digitalmars.D.learn instead of reopening this issue.


-- 



More information about the Digitalmars-d-bugs mailing list