www.digitalmars.com         C & C++   DMDScript  

c++ - [bug] template type deductions

Walter,

just tried a couple of my test-cases I have come up when improving the
OpenWatcom C++ compiler with the latest DigitalMars C++ beta:

dmc apparently gets completely confused by this one:

template<class T>
struct A
{
    template<class U>
    struct B
    { };
};

template<class T>
const A<int>::B<T> *f(const A<int>::B<T> &)
{
    return 0;
}

template<class T, class U>
// Error: order of arguments must match template parameter list
const typename A<T>::template B<U> *g(typename A<T>::template B<U>)
{
    return 0;
}

int main()
{
    A<int>::B<long> b;

    const A<int>::B<long> *fb = f(b);
    // Error: undefined identifier 'f'
    const A<int>::B<long> *gb = g<int>(b);
    // Error: undefined identifier 'g'

    return 0;
    // Error: '=', ';' or ',' expected
}


Christof

-- 
http://cmeerw.org                              sip:cmeerw at cmeerw.org
mailto:cmeerw at cmeerw.org                   xmpp:cmeerw at cmeerw.org
Dec 10 2006