www.digitalmars.com Home | Search | C & C++ | D | DMDScript | News Groups | index | prev | next
Archives

D Programming
D
D.gnu
digitalmars.D
digitalmars.D.bugs
digitalmars.D.dtl
digitalmars.D.dwt
digitalmars.D.announce
digitalmars.D.learn
digitalmars.D.debugger

C/C++ Programming
c++
c++.announce
c++.atl
c++.beta
c++.chat
c++.command-line
c++.dos
c++.dos.16-bits
c++.dos.32-bits
c++.idde
c++.mfc
c++.rtl
c++.stl
c++.stl.hp
c++.stl.port
c++.stl.sgi
c++.stlsoft
c++.windows
c++.windows.16-bits
c++.windows.32-bits
c++.wxwindows

digitalmars.empire
digitalmars.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