This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/13306] New: compilation error when trying to instantiate a template member function of a template class in another template function


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]