This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/13306] New: compilation error when trying to instantiate a template member function of a template class in another template function
- From: "ydi at bam-us dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 4 Dec 2003 22:52:51 -0000
- Subject: [Bug c++/13306] New: compilation error when trying to instantiate a template member function of a template class in another template function
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
I encountered this problem with GCC 3.3.2 on a Redhat 8.0 platform, as well as
with GCC 3.3.1 on Cygwin running on Windows 2000.
When I try to compile the following code:
template <class X>
class A {
public:
template <class Y>
void g() {}
};
template<class T>
void f() {
A<int> a;
a.g<double>();
}
The compiler will report "parse error before '>' token" on the line
"a.g<double>()".
An interesting thing is that if I substitute that line with "a.f<double>()",
although there is no member function called "f" in class "A", the compiler will
accept it as long as the template function "f" is not instantiated.
The above code is accepted by Visual C++ 2003.
--
Summary: compilation error when trying to instantiate a template
member function of a template class in another template
function
Product: gcc
Version: 3.3.2
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: ydi at bam-us dot com
CC: gcc-bugs at gcc dot gnu dot org
GCC host triplet: i686-pc-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13306