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++/17080] New: internal compiler error on template class in template class;


This program make gcc 3.3.3 report an "internal compiler error, segfault":
(that's the complete source code, no includes needed; compiler version included 
in comment in code)

----------------------------

#define TRIGGER_BUG

class EmptyClass {};

template <template <class U_client> class T_coreService> 
class SubClass { 
protected:
	template <class U_client> class CoreService : public T_coreService< U_client > 
{};
public:
	class Core : public CoreService< EmptyClass > {};
};	

#ifdef TRIGGER_BUG

/****
*****
*****

This makes the declaration of X_list in the main() segfault gcc 3.3.3:
Reading specs from /KNOPPIX/usr/bin/../lib/gcc-lib/i486-linux/3.3.3/specs
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
Thread model: posix
gcc version 3.3.3 (Debian 20040429)

*****
*****
*****/

template <class U>
class CollectionServices {
public:
	template <class U_client> class CoreService : public U_client {};	
};

template <class U>
class Collection : public SubClass<CollectionServices<U>::CoreService> {};

#else

/****
*****
*****

This code does not trigger the bug, the thing changes is that this class
have no <class U> param, and so is invoked by the Collection declaration.

*****
*****
*****/

class CollectionServices {
public:
	template <class U_client> class CoreService : public U_client {};	
};

class Collection : public SubClass<CollectionServices::CoreService> {};

#endif

struct Dummy {};

typedef Collection<Dummy>::Core List;  

int main() {

	List X_list;
	
	return 0;
		
}

-- 
           Summary: internal compiler error on template class in template
                    class;
           Product: gcc
           Version: 3.3.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: pippadav at dei dot unipd dot it
                CC: gcc-bugs at gcc dot gnu dot org


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


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