This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/26912] New: friend const member function specialization fails to compile
- From: "Thomas8675309 at yahoo dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 29 Mar 2006 03:27:09 -0000
- Subject: [Bug c++/26912] New: friend const member function specialization fails to compile
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
The following code:
struct Foo {
template<class T> int func() const;
};
class Bar {
friend int Foo::func<int>() const; // line 6
};
gives the following error under gcc 4.1.0:
C:\djgpp>gcc -c z:\proj\gccerr.cpp
z:\proj\gccerr.cpp:6: error: template-id 'func<int>' for 'int
Foo::func<int>()' does not match any template declaration
C:\djgpp>gcc -v
Using built-in specs.
Target: djgpp
Configured with: /gnu/gcc-4.10/configure djgpp --prefix=/dev/env/DJDIR
--disable
-nls --disable-werror --enable-languages=c,c++,fortran,objc,obj-c++,ada
Thread model: single
gcc version 4.1.0
C:\djgpp>gcc -v -c z:\proj\gccerr.cpp
Using built-in specs.
Target: djgpp
Configured with: /gnu/gcc-4.10/configure djgpp --prefix=/dev/env/DJDIR
--disable
-nls --disable-werror --enable-languages=c,c++,fortran,objc,obj-c++,ada
Thread model: single
gcc version 4.1.0
c:/djgpp/bin/../libexec/gcc/djgpp/4.10/cc1plus.exe -quiet -v -iprefix
c:/djgpp/
bin/../lib/gcc/djgpp/4.10/ -remap -imacros
c:/djgpp/bin/../lib/gcc/djgpp/4.10/dj
gpp.ver z:\proj\gccerr.cpp -quiet -dumpbase gccerr.cpp -mtune=pentium -auxbase
gccerr -version -o c:/djgpp/tmp/cczwyr7J.s
ignoring nonexistent directory
"c:/djgpp/bin/../lib/gcc/djgpp/4.10/../../../../d
jgpp/include"
ignoring nonexistent directory "c:/djgpp/djgpp/include/"
#include "..." search starts here:
#include <...> search starts here:
c:/djgpp/bin/../lib/gcc/djgpp/4.10/../../../../include/cxx/4.10
c:/djgpp/bin/../lib/gcc/djgpp/4.10/../../../../include/cxx/4.10/djgpp
c:/djgpp/bin/../lib/gcc/djgpp/4.10/../../../../include/cxx/4.10/backward
c:/djgpp/bin/../lib/gcc/djgpp/4.10/include
c:/djgpp/include/cxx/4.10/
c:/djgpp/include/cxx/4.10/djgpp/
c:/djgpp/include/cxx/4.10/backward/
c:/djgpp/lib/gcc/djgpp/4.10/include/
c:/djgpp/include/
End of search list.
GNU C++ version 4.1.0 (djgpp)
compiled by GNU C version 4.1.0.
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
Compiler executable checksum: a3a6c870906aa82e2d798a28b9e97cf3
z:\proj\gccerr.cpp:6: error: template-id 'func<int>' for 'int Foo::func<int>()
' does not match any template declaration
gcc 3.4.5 compiles the code without diagnostic, as does Comeau.
Both gcc 3.4.5 and gcc 4.1.0 compile the code cleanly if I change
Foo::func to be non-const:
struct Foo {
template<class T> int func();
};
class Bar {
friend int Foo::func<int>(); // line 6
};
--
Summary: friend const member function specialization fails to
compile
Product: gcc
Version: 4.1.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: Thomas8675309 at yahoo dot com
GCC build triplet: 4.1.0
GCC host triplet: 4.1.0
GCC target triplet: 4.1.0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26912