c++/795
Martin Sebor
sebor@roguewave.com
Mon Nov 27 21:11:00 GMT 2000
Martin Sebor wrote:
>
...
>
> Here's another more comprehensive testcase that should IMO compile as well (it
> does with EDG eccp 2.44).
>
> template <class T>
> struct S
> {
> template <class U>
> void foo () { }
Oops, foo() needs to be static:
template <class U>
static void foo () { }
Sorry.
Martin
> };
>
> template <class T>
> void bar ()
> {
> S<int> si;
> S<T> st;
>
> S<int> *psi = 0;
> S<T> *pst = 0;
>
> si.foo<int>();
> si.foo<T>();
> st.template foo<int>();
> st.template foo<T>();
>
> psi->foo<int>();
> psi->foo<T>();
> pst->template foo<int>();
> pst->template foo<T>();
>
> psi[0].foo<int>();
> psi[0].foo<T>();
> pst[0].template foo<int>();
> pst[0].template foo<T>();
>
> S<int>::foo<int>();
> S<int>::foo<T>();
> S<T>::template foo<int>();
> S<T>::template foo<T>();
> }
>
> int main ()
> {
> bar<int>();
> }
>
> >
> > nathan
> > --
> > Dr Nathan Sidwell :: http://www.codesourcery.com :: CodeSourcery LLC
> > 'But that's a lie.' - 'Yes it is. What's your point?'
> > nathan@codesourcery.com : http://www.cs.bris.ac.uk/~nathan/ : nathan@acm.org
More information about the Gcc-bugs
mailing list