This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/14389] New: Can't define inline overloaded template function members out of their class.



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

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 >();
}

-- 
           Summary: Can't define inline overloaded template function members
                    out of their class.
           Product: gcc
           Version: 3.3
            Status: UNCONFIRMED
          Severity: critical
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: fasbjx at free dot fr
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i486-pc-linux-gnu
  GCC host triplet: i486-pc-linux-gnu
GCC target triplet: i486-pc-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14389


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]