public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/17080] New: internal compiler error on template class in template class;
@ 2004-08-18 12:32 pippadav at dei dot unipd dot it
  2004-08-18 12:57 ` [Bug c++/17080] " reichelt at gcc dot gnu dot org
  2004-08-18 21:18 ` pippadav at dei dot unipd dot it
  0 siblings, 2 replies; 3+ messages in thread
From: pippadav at dei dot unipd dot it @ 2004-08-18 12:32 UTC (permalink / raw)
  To: gcc-bugs

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug c++/17080] internal compiler error on template class in template class;
  2004-08-18 12:32 [Bug c++/17080] New: internal compiler error on template class in template class; pippadav at dei dot unipd dot it
@ 2004-08-18 12:57 ` reichelt at gcc dot gnu dot org
  2004-08-18 21:18 ` pippadav at dei dot unipd dot it
  1 sibling, 0 replies; 3+ messages in thread
From: reichelt at gcc dot gnu dot org @ 2004-08-18 12:57 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From reichelt at gcc dot gnu dot org  2004-08-18 12:57 -------
Your code is invalid. You should write

template <class U>
class Collection : public SubClass<CollectionServices<U>::template CoreService>

instead of 

template <class U>
class Collection : public SubClass<CollectionServices<U>::CoreService>

The code then compiles fine (since gcc 3.1).

The ICE for the invalid code was fixed in gcc 3.4.0,
and since it's not a regression I'm closing the PR.

(I'm sure it's a duplicate of some other PR, but I can't find which one.)


-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |reichelt at gcc dot gnu dot
                   |                            |org
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|---                         |3.4.0


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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug c++/17080] internal compiler error on template class in template class;
  2004-08-18 12:32 [Bug c++/17080] New: internal compiler error on template class in template class; pippadav at dei dot unipd dot it
  2004-08-18 12:57 ` [Bug c++/17080] " reichelt at gcc dot gnu dot org
@ 2004-08-18 21:18 ` pippadav at dei dot unipd dot it
  1 sibling, 0 replies; 3+ messages in thread
From: pippadav at dei dot unipd dot it @ 2004-08-18 21:18 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pippadav at dei dot unipd dot it  2004-08-18 21:18 -------

I suspected my code was invalid in a way like that, but expected
gcc <3.4 to compile it, instead of crashing. 

Thank you for the hint ! :)



-- 


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


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2004-08-18 21:18 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-08-18 12:32 [Bug c++/17080] New: internal compiler error on template class in template class; pippadav at dei dot unipd dot it
2004-08-18 12:57 ` [Bug c++/17080] " reichelt at gcc dot gnu dot org
2004-08-18 21:18 ` pippadav at dei dot unipd dot it

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).