This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/13561] New: template functions in classes
- From: "gcc-bugzilla at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 4 Jan 2004 08:09:48 -0000
- Subject: [Bug c++/13561] New: template functions in classes
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
gcc rejects enclosed code; template instantiation of function f()
in function g() produces 'parse error before ;', indepenedently of
template paramenter (int, void, T, B, etc). Problem disapperars when
function g() is renamed to f() (works with all one-latter names, when
both names are the same). Repeated also on MinGW 3.2, cygwin 3.3.1,
cygwin 2.95 reports 'parse error before >', or ICEs on more
complex code
(I haven't found nothing similar in ChangLog).
structs are only to preserve space, class'es with public:'s
fail as well. Also with template parameter type 'class' instead of
'typename'
Environment:
System: SunOS residue.ict.pwr.wroc.pl 5.7 Generic_106541-20 sun4u sparc SUNW,Ultra-5_10
Architecture: sun4
host: sparc-sun-solaris2.7
build: sparc-sun-solaris2.7
target: sparc-sun-solaris2.7
configured with: ../configure --with-as=/usr/local/bin/as --with-ld=/usr/local/bin/ld
How-To-Repeat:
struct A
{
template<typename T> void f() { }
};
class B
{
A a;
template<typename T> void g() { a.f<int>(); }
}
------- Additional Comments From pepe at residue dot ict dot pwr dot wroc dot pl 2004-01-04 08:09 -------
Fix:
I have no idea, besides above :(
--
Summary: template functions in classes
Product: gcc
Version: 3.0.2
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: pepe at residue dot ict dot pwr dot wroc dot pl
CC: gcc-bugs at gcc dot gnu dot org
GCC build triplet: sparc-sun-solaris2.7
GCC host triplet: sparc-sun-solaris2.7
GCC target triplet: sparc-sun-solaris2.7
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13561