[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
template argument required
From: |
Patrick Rammelt |
Subject: |
template argument required |
Date: |
Sun, 15 May 2005 12:57:02 +0200 |
User-agent: |
Mozilla Thunderbird 0.5 (X11/20040208) |
Hi
I have just upgraded from gcc-3.3.3 to gcc-4.0.0 Trying to compile some
old code I stumbled over an error. I created this short example:
-------------------- gcctest.cpp -----------------------------
#include <iostream>
using namespace ::std;
template <class T>
class A {
public:
A (void) {}
template <class X>
class A& foo (X p) { // no error without "class"
cout << "template foo\n";
return(*this);
}
};
int main (void) {
A<double> a1, a2;
a1.foo(a2); // line 22: error (see below)
exit(0);
}
--------------------------------------------------------------------
no errors when compiling it with g++-3.3.3, but g++-4.0.0 (and
g++-3.4.1) complaints:
gcctest.cpp: In function ‘int main()’:
gcctest.cpp:22: error: template argument required for ‘struct A’
gcctest.cpp:22: error: no matching function for call to
‘A<double>::foo(A<double>&)’
Substituting "class A&" by just "A&" in foo it compiles without any
warnings or errors (and works as expected). Does this make any sense, or
is it a bug?
Thanks and ciao,
Patrick
--
Email see: http://user.cs.tu-berlin.de/~rammelt/mail.gif
- template argument required,
Patrick Rammelt <=