This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
c++/7745: gcc 3.2 rejects legal member template overload
- From: acm at alumni dot brown dot edu
- To: gcc-gnats at gcc dot gnu dot org
- Date: 28 Aug 2002 14:02:57 -0000
- Subject: c++/7745: gcc 3.2 rejects legal member template overload
- Reply-to: acm at alumni dot brown dot edu
>Number: 7745
>Category: c++
>Synopsis: gcc 3.2 rejects legal member template overload
>Confidential: no
>Severity: critical
>Priority: medium
>Responsible: unassigned
>State: open
>Class: rejects-legal
>Submitter-Id: net
>Arrival-Date: Wed Aug 28 07:06:01 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator: Andrew Morrow
>Release: gcc version 3.2
>Organization:
>Environment:
System: SunOS <sanitized> 5.8 Generic_108528-13 sun4u sparc SUNW,UltraAX-i2
Architecture: sun4
host: sparc-sun-solaris2.8
>Description:
In attached code, the second overload of the member template create in class Factory is rejected in gcc 3.2. This construction was accepted in 3.1 (as well as Forte 6U2 and the comeau online front end) and appears to be legal. Output data:
g++ -v -save-temps member_template_failure.cpp
Reading specs from /usr/local/software/gcc-3.2/lib/gcc-lib/sparc-sun-solaris2.8/3.2/specs
Configured with: ../../gcc-3.2/configure --prefix=/usr/local/software/gcc-3.2 --enable-languages=c,c++ --disable-nls --enable-shared --enable-threads
Thread model: posix
gcc version 3.2
/usr/local/software/gcc-3.2/lib/gcc-lib/sparc-sun-solaris2.8/3.2/cpp0 -lang-c++ -D__GNUG__=3 -D__DEPRECATED -D__EXCEPTIONS -v -D__GNUC__=3 -D__GNUC_MINOR__=2 -D__GNUC_PATCHLEVEL__=0 -D__GXX_ABI_VERSION=102 -Dsparc -Dsun -Dunix -D__svr4__ -D__SVR4 -D__PRAGMA_REDEFINE_EXTNAME -D__sparc__ -D__sun__ -D__unix__ -D__svr4__ -D__SVR4 -D__PRAGMA_REDEFINE_EXTNAME -D__sparc -D__sun -D__unix -Asystem=unix -Asystem=svr4 -D__NO_INLINE__ -D__STDC_HOSTED__=1 -D_XOPEN_SOURCE=500 -D_LARGEFILE_SOURCE=1 -D_LARGEFILE64_SOURCE=1 -D__EXTENSIONS__ -D__SIZE_TYPE__=unsigned int -D__PTRDIFF_TYPE__=int -D__WCHAR_TYPE__=long int -D__WINT_TYPE__=long int -D__GCC_NEW_VARARGS__ -Acpu=sparc -Amachine=sparc member_template_failure.cpp member_template_failure.ii
GNU CPP version 3.2 (cpplib) (sparc ELF)
ignoring nonexistent directory "/usr/local/software/gcc-3.2/sparc-sun-solaris2.8/include"
#include "..." search starts here:
#include <...> search starts here:
/usr/local/software/gcc-3.2/include/c++/3.2
/usr/local/software/gcc-3.2/include/c++/3.2/sparc-sun-solaris2.8
/usr/local/software/gcc-3.2/include/c++/3.2/backward
/usr/local/include
/usr/local/software/gcc-3.2/include
/usr/local/software/gcc-3.2/lib/gcc-lib/sparc-sun-solaris2.8/3.2/include
/usr/include
End of search list.
/usr/local/software/gcc-3.2/lib/gcc-lib/sparc-sun-solaris2.8/3.2/cc1plus -fpreprocessed member_template_failure.ii -quiet -dumpbase member_template_failure.cpp -version -o member_template_failure.s
GNU CPP version 3.2 (cpplib) (sparc ELF)
GNU C++ version 3.2 (sparc-sun-solaris2.8)
compiled by GNU C version 3.2.
member_template_failure.cpp:20: `template<class _Type_, class _Interface_>
_Interface_* Factory::create() const' and `template<class _Type_> Interface*
Factory::create() const' cannot be overloaded
member_template_failure.cpp:32: prototype for `_Interface_* Factory::create()
const' does not match any in class `Factory'
member_template_failure.cpp:17: candidate is: template<class _Type_> Interface*
Factory::create() const
member_template_failure.cpp:32: template definition of non-template `
_Interface_* Factory::create() const'
member_template_failure.cpp: In function `int main(int, char**)':
member_template_failure.cpp:42: no matching function for call to `Factory::
create()'
>How-To-Repeat:
Compile attached file member_template_failure.cpp. This file does not include any headers, and so is submitted as source, not preprocessed output.
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted: