[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Definition of inline overloaded template function members



>Submitter-Id:	net
>Originator:	Franck Branjonneau
>Organization:	
>Confidential:	no
>Synopsis:	 Can't define inline overloaded template function members out of their class.
>Severity:	 critical
>Priority:	 medium
>Category:	 c++
>Class:		 rejects-legal ice-on-legal-code
>Release:	3.3.3 20040125 (prerelease) (Debian) (Debian testing/unstable)
>Environment:
System: Linux alpha.tchume.net 2.6.3 #1 SMP Fri Feb 27 15:52:02 UTC 2004 x86_64 GNU/Linux
Architecture: x86_64

	
host: i486-pc-linux-gnu
build: i486-pc-linux-gnu
target: i486-pc-linux-gnu
configured with: ../src/configure -v --enable-languages=c,c++,java,f77,pascal,objc,ada,treelang --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-gxx-include-dir=/usr/include/c++/3.3 --enable-shared --with-system-zlib --enable-nls --without-included-gettext --enable-__cxa_atexit --enable-clocale=gnu --enable-debug --enable-java-gc=boehm --enable-java-awt=xlib --enable-objc-gc i486-linux
>Description: Can't define inline overloaded template function members out of their class. g++ errors depends of the set of functions.

	
>How-To-Repeat:
Compile fine:

#include <iostream>

struct S {

 template< typename _B, typename _A >
 inline void
 foo() { std::cout << "AB\n"; }

 template< typename _A >
 inline void
 foo() { std::cout << "A\n"; }

};

int
main() {

  S s;
  s.foo< void >();
  s.foo< void, void >();
}


Don't compile:

struct S {

 template< typename _B, typename _A >
 inline void
 foo();

 template< typename _A >
 inline void
 foo();

};

template< typename _A >
inline void
S::foo() { std::cout << "A\n"; }

template< typename _B, typename _A >
inline void
S::foo() { std::cout << "AB\n"; }

int
main() {

  S s;
  s.foo< void >();
  s.foo< void, void >();
}


ICE(in tsubst, at cp/pt.c:6762): 

struct S {

 template< typename _A >
 inline void
 foo();

 template< int _i >
 inline void
 foo();
 
}; // struct S

template< typename _A >
inline void
S::foo() { std::cout << "A\n"; }

template< int _i >
inline void
foo() { std::cout << "const\n"; };


int
main() {

  S s;
  s.foo< 0 >();
  s.foo< void >();
}

	
>Fix:
	



Reply to: