c++/3825: Problems in instanciation of generic members.

fasbjx@libertysurf.fr fasbjx@libertysurf.fr
Wed Jul 25 15:36:00 GMT 2001

>Number:         3825
>Category:       c++
>Synopsis:       Problems in instanciation of generic members.
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Jul 25 15:36:00 PDT 2001
>Originator:     Franck Branjonneau
>Release:        3.0 (Debian) (Debian testing/unstable)
System: Linux alpha.tchume.net 2.4.4 #2 mar mai 22 08:16:07 CEST 2001 i586 unknown
Architecture: i586

host: i386-pc-linux-gnu
build: i386-pc-linux-gnu
target: i386-pc-linux-gnu
configured with: ../src/configure -v --enable-languages=c,c++,java,f77,proto,objc --prefix=/usr --infodir=/share/info --mandir=/share/man --enable-shared --with-gnu-as --with-gnu-ld --with-system-zlib --enable-long-long --enable-nls --without-x --without-included-gettext --disable-checking --enable-threads=posix --enable-java-gc=boehm --with-cpp-install-dir=bin --enable-objc-gc i386-linux
The following code:

template< typename X, typename Y, int = 1 >
struct C1 {
  template< int, int >
  struct C2 {
    enum { v = false };

enum X { a, b, c, d };

struct C1< X, X >::C2< a, a > {
  enum { v = true };

template< int a >
struct C1< X, X >::C2< a, a > {
  enum { v = true };

template< typename X >
struct D: public C1< X, X, 5 > {
  template< int a >
  struct C1< X, X, 5 >::C2< a, a > {
    enum { v = true };

//template C1< X, X >;
//template D< X >;

#include <iostream>
int main() {
  std::cout << D< X >::C2< a, a >::v << std::endl;

gives(from www.codesourcery.com)

GCC Output

These are the results of processing your source code with the following command:

    g++ [input] 

Exit code: 256


    /usr/tmp/@4352.7.cc: In instantiation of `C1::C2<0, 0>':
    /usr/tmp/@4352.7.cc:36:   instantiated from here
    /usr/tmp/@4352.7.cc:36: Internal compiler error in tsubst, at cp/pt.c:6376

In my environment, messages are slightly different:

g++-3.0 tmp0.cc  
tmp0.cc: In instantiation of `C1<X, X, 5>::C2<0, 0>':
tmp0.cc:36:   instantiated from here
tmp0.cc:5: Internal compiler error in retrieve_specialization, at cp/pt.c:740



Instanciate explicitely the template ie uncomment:
//template D< X >;

Well, it's compile but I've not verify the resulting code.


More information about the Gcc-bugs mailing list