[Issue 1454] IFTI cant deduce parameter if alias argument used

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Feb 20 22:59:50 PST 2008


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


bugzilla at digitalmars.com changed:

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




------- Comment #3 from bugzilla at digitalmars.com  2008-02-21 00:59 -------
Consider the following more general case:

  template A(T) { alias R A; }
  void func(T)(A!(T).R a) { }
  void main() { func (4); }

So the call tells you that A!(T).R should be int. You need to (1) find the set
of Ts that satisfy the condition, and (2) prove that that set is { int }. I'm
not sure this is tractable, and even if it were, there's a bit too much AI
involved to make this a practical language feature.

(Thanks to Andrei for helping me with this)

C++ is not capable of doing this, either. Here's an example:

template<class T> struct Bar
{
    typedef T a;
};

template<class T> void foo(Bar<T>::A a) { }

void main()
{
    foo(3);
}


-- 



More information about the Digitalmars-d-bugs mailing list