public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/13520] New: gcc crashes with inheritance + default template parameter of nested template type
@ 2003-12-30 13:27 hetadres at email dot com
  2003-12-30 13:27 ` [Bug c++/13520] " paolo at gcc dot gnu dot org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: hetadres at email dot com @ 2003-12-30 13:27 UTC (permalink / raw)
  To: gcc-bugs

g++ crashes when instanciating template class Host in the following code.
----------
template<typename regular_type> class Policy {};


template <
	typename regular_type,
	template<typename> class OriginalPolicy
	>
class ChangedPolicy_impl {};

  
template <template<typename> class OriginalPolicy > class ChangedPolicy {
public:
	template<typename regular_type> class Type : public 
ChangedPolicy_impl<regular_type,OriginalPolicy> { };
};


template <
	typename regular_type,
	template<typename> class Policy1,
	template<typename> class Policy2 = ChangedPolicy<Policy1>::Type
	> class Host : public Policy1<regular_type>, 
		       public Policy2<regular_type> { };


int main() {
	Host<void, Policy>h;
	return 0;
}
----------
$ gcc -c try.cxx
try.cxx: In instantiation of `Host<void, Policy, ChangedPolicy<OriginalPolicy>::
Type>':
try.cxx:26:   instantiated from here
try.cxx:22: internal error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://bugs.gentoo.org/> for instructions.


I'm not absolutely sure about line 20 ("template<typename> class Policy2 = 
ChangedPolicy<Policy1>::Type"), maybe it should be "template<typename> class 
Policy2 = typename ChangedPolicy<Policy1>::Type". But then gcc says:
try.cxx:21: `template<template<class> class OriginalPolicy> template<class
   regular_type> class ChangedPolicy<OriginalPolicy>::Type' used without
   template parameters
try.cxx:21: ISO C++ forbids declaration of `type name' with no type
try.cxx:21: invalid default template argument
try.cxx: In function `int main()':
try.cxx:26: template argument 3 is invalid
try.cxx:26: ISO C++ forbids declaration of `h' with no type


I need this code to be working, because i have to hand it in at the University 
of Antwerp next month :-/

Thanks for your help.

-- 
           Summary: gcc crashes with inheritance + default template
                    parameter of nested template type
           Product: gcc
           Version: 3.2.3
            Status: UNCONFIRMED
          Severity: critical
          Priority: P1
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: hetadres at email dot com
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


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


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

* [Bug c++/13520] gcc crashes with inheritance + default template parameter of nested template type
  2003-12-30 13:27 [Bug c++/13520] New: gcc crashes with inheritance + default template parameter of nested template type hetadres at email dot com
@ 2003-12-30 13:27 ` paolo at gcc dot gnu dot org
  2003-12-30 15:34 ` paolo at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: paolo at gcc dot gnu dot org @ 2003-12-30 13:27 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From paolo at gcc dot gnu dot org  2003-12-30 13:07 -------
This is an ICE on illegal, already fixed for 3.4.
A 'template' keyword is missing:

template<typename> class Policy2 = ChangedPolicy<Policy1>::template Type
                                                           ^^^^^^^^


-- 


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


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

* [Bug c++/13520] gcc crashes with inheritance + default template parameter of nested template type
  2003-12-30 13:27 [Bug c++/13520] New: gcc crashes with inheritance + default template parameter of nested template type hetadres at email dot com
  2003-12-30 13:27 ` [Bug c++/13520] " paolo at gcc dot gnu dot org
@ 2003-12-30 15:34 ` paolo at gcc dot gnu dot org
  2003-12-30 18:00 ` pinskia at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: paolo at gcc dot gnu dot org @ 2003-12-30 15:34 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From paolo at gcc dot gnu dot org  2003-12-30 13:27 -------
... the issue seems tricky, however: EDG-based compilers accept the amended code
(as does 3.3.2) but a 20031224 snapshot of 3.4 doesn't...

-- 


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


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

* [Bug c++/13520] gcc crashes with inheritance + default template parameter of nested template type
  2003-12-30 13:27 [Bug c++/13520] New: gcc crashes with inheritance + default template parameter of nested template type hetadres at email dot com
  2003-12-30 13:27 ` [Bug c++/13520] " paolo at gcc dot gnu dot org
  2003-12-30 15:34 ` paolo at gcc dot gnu dot org
@ 2003-12-30 18:00 ` pinskia at gcc dot gnu dot org
  2003-12-31 12:21 ` [Bug c++/13520] [3.4 regression] " lerdsuwa at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2003-12-30 18:00 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2003-12-30 17:53 -------
ICC 6.0 does accept it after putting the template there.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|critical                    |normal


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


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

* [Bug c++/13520] [3.4 regression] gcc crashes with inheritance + default template parameter of nested template type
  2003-12-30 13:27 [Bug c++/13520] New: gcc crashes with inheritance + default template parameter of nested template type hetadres at email dot com
                   ` (2 preceding siblings ...)
  2003-12-30 18:00 ` pinskia at gcc dot gnu dot org
@ 2003-12-31 12:21 ` lerdsuwa at gcc dot gnu dot org
  2004-01-02 11:41 ` cvs-commit at gcc dot gnu dot org
  2004-01-02 11:42 ` lerdsuwa at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: lerdsuwa at gcc dot gnu dot org @ 2003-12-31 12:21 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From lerdsuwa at gcc dot gnu dot org  2003-12-31 10:35 -------
It's a rejects-valid for the modified testcase, probably due to 
incorrect tree node created during parsing.  GCC 3.3, 3.2 accept
the corrected testcase so it's a regression.


-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |lerdsuwa at gcc dot gnu dot
                   |dot org                     |org
             Status|UNCONFIRMED                 |ASSIGNED
           Keywords|                            |rejects-valid
            Summary|gcc crashes with inheritance|[3.4 regression] gcc crashes
                   |+ default template parameter|with inheritance + default
                   |of nested template type     |template parameter of nested
                   |                            |template type
   Target Milestone|---                         |3.4.0


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


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

* [Bug c++/13520] [3.4 regression] gcc crashes with inheritance + default template parameter of nested template type
  2003-12-30 13:27 [Bug c++/13520] New: gcc crashes with inheritance + default template parameter of nested template type hetadres at email dot com
                   ` (3 preceding siblings ...)
  2003-12-31 12:21 ` [Bug c++/13520] [3.4 regression] " lerdsuwa at gcc dot gnu dot org
@ 2004-01-02 11:41 ` cvs-commit at gcc dot gnu dot org
  2004-01-02 11:42 ` lerdsuwa at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2004-01-02 11:41 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2004-01-02 11:41 -------
Subject: Bug 13520

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	lerdsuwa@gcc.gnu.org	2004-01-02 11:41:51

Modified files:
	gcc/cp         : ChangeLog cp-tree.h parser.c 
	gcc/testsuite  : ChangeLog 
Added files:
	gcc/testsuite/g++.dg/template: qualttp22.C 

Log message:
	PR c++/13520
	* cp-tree.h (DECL_UNBOUND_CLASS_TEMPLATE_P): New macro.
	(DECL_FUNCTION_TEMPLATE_P): Use it.
	(DECL_CLASS_TEMPLATE_P): Likewise.
	* parser.c (cp_parser_lookup_name): Add is_template parameter.
	(cp_parser_type_parameter): Adjust call to cp_parser_lookup_name.
	(cp_parser_template_name): Likewise.
	(cp_parser_elaborated_type_specifier): Likewise.
	(cp_parser_namespace_name): Likewise.
	(cp_parser_class_name): Likewise.
	(cp_parser_lookup_name_simple): Likewise.
	
	* g++.dg/template/qualttp22.C: New test.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&r1=1.3845&r2=1.3846
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/cp-tree.h.diff?cvsroot=gcc&r1=1.944&r2=1.945
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/parser.c.diff?cvsroot=gcc&r1=1.141&r2=1.142
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.3329&r2=1.3330
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/template/qualttp22.C.diff?cvsroot=gcc&r1=NONE&r2=1.1



-- 


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


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

* [Bug c++/13520] [3.4 regression] gcc crashes with inheritance + default template parameter of nested template type
  2003-12-30 13:27 [Bug c++/13520] New: gcc crashes with inheritance + default template parameter of nested template type hetadres at email dot com
                   ` (4 preceding siblings ...)
  2004-01-02 11:41 ` cvs-commit at gcc dot gnu dot org
@ 2004-01-02 11:42 ` lerdsuwa at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: lerdsuwa at gcc dot gnu dot org @ 2004-01-02 11:42 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From lerdsuwa at gcc dot gnu dot org  2004-01-02 11:42 -------
Fixed in the main trunk.  It will be eventually released as GCC 3.4.0.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED


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


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

end of thread, other threads:[~2004-01-02 11:42 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-12-30 13:27 [Bug c++/13520] New: gcc crashes with inheritance + default template parameter of nested template type hetadres at email dot com
2003-12-30 13:27 ` [Bug c++/13520] " paolo at gcc dot gnu dot org
2003-12-30 15:34 ` paolo at gcc dot gnu dot org
2003-12-30 18:00 ` pinskia at gcc dot gnu dot org
2003-12-31 12:21 ` [Bug c++/13520] [3.4 regression] " lerdsuwa at gcc dot gnu dot org
2004-01-02 11:41 ` cvs-commit at gcc dot gnu dot org
2004-01-02 11:42 ` lerdsuwa at gcc dot gnu dot org

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).