This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
c++/3614: failing overloading of template member functions in template classes
- To: gcc-gnats at gcc dot gnu dot org
- Subject: c++/3614: failing overloading of template member functions in template classes
- From: sts at ica1 dot uni-stuttgart dot de
- Date: 9 Jul 2001 09:51:05 -0000
- Reply-To: sts at ica1 dot uni-stuttgart dot de
>Number: 3614
>Category: c++
>Synopsis: failing overloading of template member functions in template classes
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Mon Jul 09 02:56:01 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator: sts@ica1.uni-stuttgart.de
>Release: gcc-3.0
>Organization:
>Environment:
alpha OSF 5.0, ix86-linux
>Description:
// I cannot see a problem with the syntax of the following
// fragment; shouldn't one be able to overload template and
// non-template functions in class scopes and be able to declare
// them out of line? From the examples in Sec. 14 of the standard
// my guess is that the fragment below uses the syntax intended for
// this purpose. EDG compilers treat this fragment as I expect (the
// executable returns 0 to the environent)
// the _inline_ definition of the functions IN the class
// body works as expected
// Stefan Schwarzer sts@ica1.uni-stuttgart.de
// 11:30 tiger_sts:gnu/current> g++ -v
// Reading specs from /local/gcc-3.0/lib/gcc-lib/alphaev56-dec-osf4.0f/3.0/specs
// Configured with: /share/src/gcc-3.0/configure --prefix=/local/gcc-3.0 --host=
alphaev56-dec-osf4.0f --target=alphaev56-dec-osf4.0f
// Thread model: single
// gcc version 3.0
// 11:30 tiger_sts:gnu/current> g++ class_tmpl_ovld.cc
// class_tmpl_ovld.cc:28: redefinition of `int A<N>::f()'
// class_tmpl_ovld.cc:25: `int A<N>::f()' previously declared here
// class_tmpl_ovld.cc:28: expected 2 levels of template parms for `int A<N>::f()
',
// got 1
// class_tmpl_ovld.cc:20: confused by earlier errors, bailing out
template<int N>
struct A {
int f();
template<int M>
int f();
};
template<int N> template<int M>
int A<N>::f(){ return M; }
template<int N>
int A<N>::f(){ return 1; }
// should compile and return 0
int main(){
A<42> a;
return a.f<0>();
}
>How-To-Repeat:
see problem description
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted: