public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/32029]  New: Internal Compiler Error on instantiation of template parameter
@ 2007-05-22  4:00 ejt at andrew dot cmu dot edu
  2007-05-22  4:00 ` [Bug c++/32029] " ejt at andrew dot cmu dot edu
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: ejt at andrew dot cmu dot edu @ 2007-05-22  4:00 UTC (permalink / raw)
  To: gcc-bugs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1380 bytes --]

When there is a default template parameter based on a templated class member
type, the compiler dies a nasty death.  As far as I can tell, gcc prior to 4.1
branch works fine, but all of the 4.1 branch seems to have this problem.

Quick summary... This works:
  template<class T, Al=typename Factory0Arg<T>::template Factory<T> > class
thing {/*...*/};

This ICEs:
  template<class T, Al=class Factory0Arg<T>::Factory<T> > class thing
{/*...*/};
whenever you try to instantiate 'thing', as seen below:
$ g++ -Wall bug.cc -o bug
bug.cc: In instantiation of ‘Factory0Arg<foo>::Factory<foo>’:
bug.cc:41:   instantiated from ‘void thing<T, Al>::makeIt() [with T = foo, Al =
Factory0Arg<foo>::Factory<foo>]’
bug.cc:53:   instantiated from here
bug.cc:19: internal compiler error: in instantiate_class_template, at
cp/pt.c:5666

I would at least hope for a better error message assuming that's not valid
syntax ;)

I'll attach original and preprocessed source.


-- 
           Summary: Internal Compiler Error on instantiation of template
                    parameter
           Product: gcc
           Version: 4.1.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: ejt at andrew dot cmu dot edu


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


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

* [Bug c++/32029] Internal Compiler Error on instantiation of template parameter
  2007-05-22  4:00 [Bug c++/32029] New: Internal Compiler Error on instantiation of template parameter ejt at andrew dot cmu dot edu
@ 2007-05-22  4:00 ` ejt at andrew dot cmu dot edu
  2007-05-22  4:02 ` ejt at andrew dot cmu dot edu
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: ejt at andrew dot cmu dot edu @ 2007-05-22  4:00 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from ejt at andrew dot cmu dot edu  2007-05-22 05:00 -------
Created an attachment (id=13599)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=13599&action=view)
Original source


-- 


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


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

* [Bug c++/32029] Internal Compiler Error on instantiation of template parameter
  2007-05-22  4:00 [Bug c++/32029] New: Internal Compiler Error on instantiation of template parameter ejt at andrew dot cmu dot edu
  2007-05-22  4:00 ` [Bug c++/32029] " ejt at andrew dot cmu dot edu
@ 2007-05-22  4:02 ` ejt at andrew dot cmu dot edu
  2007-05-24  2:18 ` pinskia at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: ejt at andrew dot cmu dot edu @ 2007-05-22  4:02 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from ejt at andrew dot cmu dot edu  2007-05-22 05:01 -------
Created an attachment (id=13600)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=13600&action=view)
Preprocessed source


-- 


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


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

* [Bug c++/32029] Internal Compiler Error on instantiation of template parameter
  2007-05-22  4:00 [Bug c++/32029] New: Internal Compiler Error on instantiation of template parameter ejt at andrew dot cmu dot edu
  2007-05-22  4:00 ` [Bug c++/32029] " ejt at andrew dot cmu dot edu
  2007-05-22  4:02 ` ejt at andrew dot cmu dot edu
@ 2007-05-24  2:18 ` pinskia at gcc dot gnu dot org
  2007-12-26 20:58 ` [Bug c++/32029] [4.1/4.2/4.3 regression] ICE " reichelt at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2007-05-24  2:18 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from pinskia at gcc dot gnu dot org  2007-05-24 03:18 -------
Here is a reduced testcase:
template<class Base>
struct Factory0Arg
{
        template<class T> struct Factory { };
};
template<class T, class Al=class Factory0Arg<T>::Factory<T> >
struct thing {
                Al allocator;
};
thing<int> t;


-- 


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


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

* [Bug c++/32029] [4.1/4.2/4.3 regression] ICE on instantiation of template parameter
  2007-05-22  4:00 [Bug c++/32029] New: Internal Compiler Error on instantiation of template parameter ejt at andrew dot cmu dot edu
                   ` (2 preceding siblings ...)
  2007-05-24  2:18 ` pinskia at gcc dot gnu dot org
@ 2007-12-26 20:58 ` reichelt at gcc dot gnu dot org
  2008-01-24 12:18 ` pcarlini at suse dot de
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: reichelt at gcc dot gnu dot org @ 2007-12-26 20:58 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from reichelt at gcc dot gnu dot org  2007-12-26 20:58 -------
Confirmed.

The correct syntax for the default parameter is the one that works:
typename Factory0Arg<T>::template Factory<T>

I get an ICE since GCC 3.4.0.
Before, the code was wrongly accepted.


-- 

reichelt at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |reichelt at gcc dot gnu dot
                   |                            |org
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
           Keywords|                            |ice-on-invalid-code,
                   |                            |monitored
   Last reconfirmed|0000-00-00 00:00:00         |2007-12-26 20:58:09
               date|                            |
            Summary|Internal Compiler Error on  |[4.1/4.2/4.3 regression] ICE
                   |instantiation of template   |on instantiation of template
                   |parameter                   |parameter
   Target Milestone|---                         |4.1.3


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


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

* [Bug c++/32029] [4.1/4.2/4.3 regression] ICE on instantiation of template parameter
  2007-05-22  4:00 [Bug c++/32029] New: Internal Compiler Error on instantiation of template parameter ejt at andrew dot cmu dot edu
                   ` (3 preceding siblings ...)
  2007-12-26 20:58 ` [Bug c++/32029] [4.1/4.2/4.3 regression] ICE " reichelt at gcc dot gnu dot org
@ 2008-01-24 12:18 ` pcarlini at suse dot de
  2008-01-26 14:36 ` reichelt at gcc dot gnu dot org
  2008-01-28 17:22 ` jason at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: pcarlini at suse dot de @ 2008-01-24 12:18 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from pcarlini at suse dot de  2008-01-24 12:02 -------
In mainline is now back to accepts-invalid.


-- 


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


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

* [Bug c++/32029] [4.1/4.2/4.3 regression] ICE on instantiation of template parameter
  2007-05-22  4:00 [Bug c++/32029] New: Internal Compiler Error on instantiation of template parameter ejt at andrew dot cmu dot edu
                   ` (4 preceding siblings ...)
  2008-01-24 12:18 ` pcarlini at suse dot de
@ 2008-01-26 14:36 ` reichelt at gcc dot gnu dot org
  2008-01-28 17:22 ` jason at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: reichelt at gcc dot gnu dot org @ 2008-01-26 14:36 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from reichelt at gcc dot gnu dot org  2008-01-26 14:07 -------
The 4.2 branch is now also back to accepts-invalid.
This is due to the fix for PR 33959.


-- 

reichelt at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  BugsThisDependsOn|                            |33959


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


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

* [Bug c++/32029] [4.1/4.2/4.3 regression] ICE on instantiation of template parameter
  2007-05-22  4:00 [Bug c++/32029] New: Internal Compiler Error on instantiation of template parameter ejt at andrew dot cmu dot edu
                   ` (5 preceding siblings ...)
  2008-01-26 14:36 ` reichelt at gcc dot gnu dot org
@ 2008-01-28 17:22 ` jason at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: jason at gcc dot gnu dot org @ 2008-01-28 17:22 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from jason at gcc dot gnu dot org  2008-01-28 16:33 -------
The version with "class" is also valid.

14.6p5: A qualified name used as the name in a mem-initializer-id, a
base-specifier, or an elaborated-type-specifier is implicitly assumed to name a
type, without the use of the typename keyword.

Fixed by the patch for 33959.


-- 

jason at gcc dot gnu dot org changed:

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


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


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

end of thread, other threads:[~2008-01-28 16:34 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-05-22  4:00 [Bug c++/32029] New: Internal Compiler Error on instantiation of template parameter ejt at andrew dot cmu dot edu
2007-05-22  4:00 ` [Bug c++/32029] " ejt at andrew dot cmu dot edu
2007-05-22  4:02 ` ejt at andrew dot cmu dot edu
2007-05-24  2:18 ` pinskia at gcc dot gnu dot org
2007-12-26 20:58 ` [Bug c++/32029] [4.1/4.2/4.3 regression] ICE " reichelt at gcc dot gnu dot org
2008-01-24 12:18 ` pcarlini at suse dot de
2008-01-26 14:36 ` reichelt at gcc dot gnu dot org
2008-01-28 17:22 ` jason 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).