public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* c++/9436: passing a class template followed by a template value of this class
@ 2003-01-24 18:56 dfredoui
  0 siblings, 0 replies; 3+ messages in thread
From: dfredoui @ 2003-01-24 18:56 UTC (permalink / raw)
  To: gcc-gnats


>Number:         9436
>Category:       c++
>Synopsis:       passing a class template followed by a template value of this class
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          ice-on-legal-code
>Submitter-Id:   net
>Arrival-Date:   Fri Jan 24 18:56:01 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:     dfredoui@irisa.fr
>Release:        g++-3.2.1
>Organization:
>Environment:
SunOS 5.8
>Description:
// well, just compile with g++-3.2.1 -c these few lines
// and magically the bug appears
// It comes from the affectation of defaultValue by T()
// in the following template
template <typename T, T defaultValue = T()> 
struct A{  
  A() : t(defaultValue) {}
  T t;
};

template <typename T> void fct(A<T> a){}

struct B{
  void hello(){ fct( a );}
  A<char> a;  
}; 



>How-To-Repeat:

>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:


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

* Re: c++/9436: passing a class template followed by a template value of this class
@ 2003-01-24 20:05 bangerth
  0 siblings, 0 replies; 3+ messages in thread
From: bangerth @ 2003-01-24 20:05 UTC (permalink / raw)
  To: dfredoui, gcc-bugs, gcc-prs, nobody

Synopsis: passing a class template followed by a template value of this class

State-Changed-From-To: open->analyzed
State-Changed-By: bangerth
State-Changed-When: Fri Jan 24 20:05:27 2003
State-Changed-Why:
    Confirmed with Giovanni's testcase. Crashes 3.2.2, 3.3 and
    3.4 CVS. 2.95 issues a "sorry, not implemented" error.
    
    W.

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=9436


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

* Re: c++/9436: passing a class template followed by a template value of this class
@ 2003-01-24 19:26 Giovanni Bajo
  0 siblings, 0 replies; 3+ messages in thread
From: Giovanni Bajo @ 2003-01-24 19:26 UTC (permalink / raw)
  To: nobody; +Cc: gcc-prs

The following reply was made to PR c++/9436; it has been noted by GNATS.

From: "Giovanni Bajo" <giovannibajo@libero.it>
To: <gcc-gnats@gcc.gnu.org>,
	<gcc-bugs@gcc.gnu.org>,
	<nobody@gcc.gnu.org>,
	<gcc-prs@gcc.gnu.org>,
	<dfredoui@irisa.fr>
Cc:  
Subject: Re: c++/9436: passing a class template followed by a template value of this class
Date: Fri, 24 Jan 2003 20:18:14 +0100

 http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&p
 r=9436
 
 Slightly reduced testcase:
 -------------------------------
 template <typename T, int P = int()>
 struct A {};
 
 template <typename T>
 void foo(A<T> ) {}
 
 void bar(void)
 {
  A<char> a;
  foo(a);
 }
 -------------------------------
 ice.cpp: In function `void bar()':
 ice.cpp:12: internal error: Segmentation fault
 Please submit a full bug report,
 
 This shows that the bug has nothing to do with the dependency between the
 first parameter and the second (default) parameter. GCC seems to crash
 (segmentation fault) when trying to specialize the foo() function, and the
 problem is that the default (and not explicitally matched) parameter P uses
 a constructor as initializer. If you substitute 'int()' with 0, or you
 explicitally match the full type by declaring the parameter of foo as
 'A<T,0>', the ICE goes away. Not tested on post 3.2, might be fixed with the
 new parser.
 
 Giovanni Bajo
 


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

end of thread, other threads:[~2003-01-24 20:05 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-01-24 18:56 c++/9436: passing a class template followed by a template value of this class dfredoui
2003-01-24 19:26 Giovanni Bajo
2003-01-24 20:05 bangerth

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