This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/17000] New: parse error calling member template function of non-lvalue from within template class member
- From: "stefaandr at hotmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 12 Aug 2004 11:08:19 -0000
- Subject: [Bug c++/17000] New: parse error calling member template function of non-lvalue from within template class member
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
I may be wrong, but I think the following is valid code, and it doesn't compile:
struct a {
template <class T> void func2() {};
};
template <class T> struct b {
void func();
a get_a() { return a(); };
};
template <class T>
void b<T>::func() {
get_a().func2 <int>();
};
Reading specs from /freeware/gcc/linux-i386/lib/gcc/i686-pc-linux-gnu/3.4.1/specs
Configured with: /freeware/gcc/gcc/gcc-3.4.1/configure --prefix=/freeware/gcc
--exec-prefix=/freeware/gcc/linux-i386 --with-local-prefix=/freeware/gcc
--enable-version-specific-runtime-libs --enable-languages=c++,f77,java
--enable-threads=posix
Thread model: posix
gcc version 3.4.1
/freeware/gcc/linux-i386/libexec/gcc/i686-pc-linux-gnu/3.4.1/cc1plus -quiet -v
-D_GNU_SOURCE test2.cpp -quiet -dumpbase test2.cpp -mtune=pentiumpro
-auxbase-strip test2.o -version -o /tmp/ccO6h17i.s
ignoring nonexistent directory
"/freeware/gcc/linux-i386/lib/gcc/i686-pc-linux-gnu/3.4.1/../../../../i686-pc-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
/freeware/gcc/linux-i386/lib/gcc/i686-pc-linux-gnu/3.4.1/include/c++
/freeware/gcc/linux-i386/lib/gcc/i686-pc-linux-gnu/3.4.1/include/c++/i686-pc-linux-gnu
/freeware/gcc/linux-i386/lib/gcc/i686-pc-linux-gnu/3.4.1/include/c++/backward
/freeware/gcc/include
/freeware/gcc/linux-i386/lib/gcc/i686-pc-linux-gnu/3.4.1/include
/usr/include
End of search list.
GNU C++ version 3.4.1 (i686-pc-linux-gnu)
compiled by GNU C version 3.4.1.
GGC heuristics: --param ggc-min-expand=81 --param ggc-min-heapsize=96849
test2.cpp: In member function `void b<T>::func()':
test2.cpp:10: error: expected primary-expression before "int"
test2.cpp:10: error: expected `;' before "int"
--
Summary: parse error calling member template function of non-
lvalue from within template class member
Product: gcc
Version: 3.4.1
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: stefaandr at hotmail dot com
CC: gcc-bugs at gcc dot gnu dot org
GCC build triplet: i686-pc-linux-gnu
GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17000