public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/13306] New: compilation error when trying to instantiate a template member function of a template class in another template function
@ 2003-12-04 22:52 ydi at bam-us dot com
  2003-12-04 22:56 ` [Bug c++/13306] " pinskia at gcc dot gnu dot org
  0 siblings, 1 reply; 2+ messages in thread
From: ydi at bam-us dot com @ 2003-12-04 22:52 UTC (permalink / raw)
  To: gcc-bugs

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [Bug c++/13306] compilation error when trying to instantiate a template member function of a template class in another template function
  2003-12-04 22:52 [Bug c++/13306] New: compilation error when trying to instantiate a template member function of a template class in another template function ydi at bam-us dot com
@ 2003-12-04 22:56 ` pinskia at gcc dot gnu dot org
  0 siblings, 0 replies; 2+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2003-12-04 22:56 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2003-12-04 22:56 -------
The problem is that GCC has a bug in it, you can workaround it with something like this:
        a.template g<double>();
Note this is a dup of bug 795 which is fixed for 3.4.

*** This bug has been marked as a duplicate of 795 ***

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |DUPLICATE


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13306


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2003-12-04 22:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-12-04 22:52 [Bug c++/13306] New: compilation error when trying to instantiate a template member function of a template class in another template function ydi at bam-us dot com
2003-12-04 22:56 ` [Bug c++/13306] " pinskia at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).