public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/30897]  New: [4.1/4.2/4.3 regression] ICE with default argument in template template parameter
@ 2007-02-20 21:24 reichelt at gcc dot gnu dot org
  2007-02-20 21:41 ` [Bug c++/30897] " reichelt at gcc dot gnu dot org
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: reichelt at gcc dot gnu dot org @ 2007-02-20 21:24 UTC (permalink / raw)
  To: gcc-bugs

The following valid code snippet triggers an ICE since GCC 3.1:

====================================================================
template<template <typename T, typename = T > class U> struct A
{
  template<int> U<int> foo();
};
====================================================================

bug.cc:3: internal compiler error: in tsubst, at cp/pt.c:7450
Please submit a full bug report, [etc.]

This is related to PR 30044, but here we have a regression.


-- 
           Summary: [4.1/4.2/4.3 regression] ICE with default argument in
                    template template parameter
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Keywords: ice-on-valid-code, monitored
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: reichelt at gcc dot gnu dot org


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


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

* [Bug c++/30897] [4.1/4.2/4.3 regression] ICE with default argument in template template parameter
  2007-02-20 21:24 [Bug c++/30897] New: [4.1/4.2/4.3 regression] ICE with default argument in template template parameter reichelt at gcc dot gnu dot org
@ 2007-02-20 21:41 ` reichelt at gcc dot gnu dot org
  2007-02-20 21:46 ` rguenth at gcc dot gnu dot org
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: reichelt at gcc dot gnu dot org @ 2007-02-20 21:41 UTC (permalink / raw)
  To: gcc-bugs



-- 

reichelt at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |4.1.3


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


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

* [Bug c++/30897] [4.1/4.2/4.3 regression] ICE with default argument in template template parameter
  2007-02-20 21:24 [Bug c++/30897] New: [4.1/4.2/4.3 regression] ICE with default argument in template template parameter reichelt at gcc dot gnu dot org
  2007-02-20 21:41 ` [Bug c++/30897] " reichelt at gcc dot gnu dot org
@ 2007-02-20 21:46 ` rguenth at gcc dot gnu dot org
  2007-03-05  4:00 ` mmitchel at gcc dot gnu dot org
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2007-02-20 21:46 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from rguenth at gcc dot gnu dot org  2007-02-20 21:46 -------
Confirmed.


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |rguenth at gcc dot gnu dot
                   |                            |org
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2007-02-20 21:46:23
               date|                            |


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


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

* [Bug c++/30897] [4.1/4.2/4.3 regression] ICE with default argument in template template parameter
  2007-02-20 21:24 [Bug c++/30897] New: [4.1/4.2/4.3 regression] ICE with default argument in template template parameter reichelt at gcc dot gnu dot org
  2007-02-20 21:41 ` [Bug c++/30897] " reichelt at gcc dot gnu dot org
  2007-02-20 21:46 ` rguenth at gcc dot gnu dot org
@ 2007-03-05  4:00 ` mmitchel at gcc dot gnu dot org
  2007-03-23  0:50 ` mmitchel at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2007-03-05  4:00 UTC (permalink / raw)
  To: gcc-bugs



-- 

mmitchel at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P1


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


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

* [Bug c++/30897] [4.1/4.2/4.3 regression] ICE with default argument in template template parameter
  2007-02-20 21:24 [Bug c++/30897] New: [4.1/4.2/4.3 regression] ICE with default argument in template template parameter reichelt at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2007-03-05  4:00 ` mmitchel at gcc dot gnu dot org
@ 2007-03-23  0:50 ` mmitchel at gcc dot gnu dot org
  2007-09-23 11:53 ` pcarlini at suse dot de
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2007-03-23  0:50 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from mmitchel at gcc dot gnu dot org  2007-03-23 00:50 -------
This code in lookup_template_class:

-      /* Consider an example where a template template parameter declared as
-
-          template <class T, class U = std::allocator<T> > class TT
-
-        The template parameter level of T and U are one level larger than
-        of TT.  To proper process the default argument of U, say when an
-        instantiation `TT<int>' is seen, we need to build the full
-        arguments containing {int} as the innermost level.  Outer levels,
-        available when not appearing as default template argument, can be
-        obtained from `current_template_args ()'.
-
-        Suppose that TT is later substituted with std::vector.  The above
-        instantiation is `TT<int, std::allocator<T> >' with TT at
-        level 1, and T at level 2, while the template arguments at level 1
-        becomes {std::vector} and the inner level 2 is {int}.  */
-
-      if (current_template_parms)
-       arglist = add_to_template_args (current_template_args (), arglist);

is simply bogus; the current template arguments have nothing to do with the
situation.  It is this code which causes the crash.

I believe that the correct change is to remove that code and to make template
parameters for template template parameters restart at level 1.  So, in:

  template <template <typename T> class A> 
  class B {};

both T and A have level 1.  (Right now, T has level 2.)

T should have level 1 because, when instantiating A, that's what make sense.


-- 


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


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

* [Bug c++/30897] [4.1/4.2/4.3 regression] ICE with default argument in template template parameter
  2007-02-20 21:24 [Bug c++/30897] New: [4.1/4.2/4.3 regression] ICE with default argument in template template parameter reichelt at gcc dot gnu dot org
                   ` (3 preceding siblings ...)
  2007-03-23  0:50 ` mmitchel at gcc dot gnu dot org
@ 2007-09-23 11:53 ` pcarlini at suse dot de
  2007-10-29 19:17 ` jason at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: pcarlini at suse dot de @ 2007-09-23 11:53 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from pcarlini at suse dot de  2007-09-23 11:52 -------
By the way, the hunk of code at issue dates back to this time:

  http://gcc.gnu.org/ml/gcc-patches/2001-10/msg00589.html

(and, by the way, I cannot find an explicit approval in the mailing list).

Anyway, the effect of removing it is fixing this PR and regressing only on the
testcase committed with it (template/ttp2.C).


-- 

pcarlini at suse dot de changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mark at codesourcery dot
                   |                            |com, pcarlini at suse dot de


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


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

* [Bug c++/30897] [4.1/4.2/4.3 regression] ICE with default argument in template template parameter
  2007-02-20 21:24 [Bug c++/30897] New: [4.1/4.2/4.3 regression] ICE with default argument in template template parameter reichelt at gcc dot gnu dot org
                   ` (4 preceding siblings ...)
  2007-09-23 11:53 ` pcarlini at suse dot de
@ 2007-10-29 19:17 ` jason at gcc dot gnu dot org
  2007-11-02  5:50 ` jason at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: jason at gcc dot gnu dot org @ 2007-10-29 19:17 UTC (permalink / raw)
  To: gcc-bugs



-- 

jason at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |jason at gcc dot gnu dot org
                   |dot org                     |
             Status|NEW                         |ASSIGNED
   Last reconfirmed|2007-08-06 15:04:53         |2007-10-29 19:17:28
               date|                            |


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


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

* [Bug c++/30897] [4.1/4.2/4.3 regression] ICE with default argument in template template parameter
  2007-02-20 21:24 [Bug c++/30897] New: [4.1/4.2/4.3 regression] ICE with default argument in template template parameter reichelt at gcc dot gnu dot org
                   ` (5 preceding siblings ...)
  2007-10-29 19:17 ` jason at gcc dot gnu dot org
@ 2007-11-02  5:50 ` jason at gcc dot gnu dot org
  2007-11-02  5:58 ` [Bug c++/30897] [4.1/4.2 " jason at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: jason at gcc dot gnu dot org @ 2007-11-02  5:50 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from jason at gcc dot gnu dot org  2007-11-02 05:50 -------
Subject: Bug 30897

Author: jason
Date: Fri Nov  2 05:50:06 2007
New Revision: 129844

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=129844
Log:
        PR c++/30897
        * pt.c (push_template_decl_real): Set DECL_CONTEXT on template
        template parms.
        (lookup_template_class): Use it to get the outer template args
        for instantiating one.

        PR c++/29236
        * pt.c (reduce_template_parm_level): tsubst the parameters
        of a template template parm.

Added:
    trunk/gcc/testsuite/g++.dg/template/ttp23.C
    trunk/gcc/testsuite/g++.dg/template/ttp24.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/pt.c


-- 


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


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

* [Bug c++/30897] [4.1/4.2 regression] ICE with default argument in template template parameter
  2007-02-20 21:24 [Bug c++/30897] New: [4.1/4.2/4.3 regression] ICE with default argument in template template parameter reichelt at gcc dot gnu dot org
                   ` (6 preceding siblings ...)
  2007-11-02  5:50 ` jason at gcc dot gnu dot org
@ 2007-11-02  5:58 ` jason at gcc dot gnu dot org
  2008-07-04 21:59 ` [Bug c++/30897] [4.2 " jsm28 at gcc dot gnu dot org
  2009-03-30 21:38 ` jsm28 at gcc dot gnu dot org
  9 siblings, 0 replies; 11+ messages in thread
From: jason at gcc dot gnu dot org @ 2007-11-02  5:58 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from jason at gcc dot gnu dot org  2007-11-02 05:58 -------
Fixed for 4.3, though  not as Mark suggested; we need to have the arguments of
the enclosing templates in order to bind names in the default argument
properly.


-- 

jason at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|jason at gcc dot gnu dot org|unassigned at gcc dot gnu
                   |                            |dot org
             Status|ASSIGNED                    |NEW
      Known to work|                            |4.3.0
            Summary|[4.1/4.2/4.3 regression] ICE|[4.1/4.2 regression] ICE
                   |with default argument in    |with default argument in
                   |template template parameter |template template parameter


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


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

* [Bug c++/30897] [4.2 regression] ICE with default argument in template template parameter
  2007-02-20 21:24 [Bug c++/30897] New: [4.1/4.2/4.3 regression] ICE with default argument in template template parameter reichelt at gcc dot gnu dot org
                   ` (7 preceding siblings ...)
  2007-11-02  5:58 ` [Bug c++/30897] [4.1/4.2 " jason at gcc dot gnu dot org
@ 2008-07-04 21:59 ` jsm28 at gcc dot gnu dot org
  2009-03-30 21:38 ` jsm28 at gcc dot gnu dot org
  9 siblings, 0 replies; 11+ messages in thread
From: jsm28 at gcc dot gnu dot org @ 2008-07-04 21:59 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from jsm28 at gcc dot gnu dot org  2008-07-04 21:58 -------
Closing 4.1 branch.


-- 

jsm28 at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[4.1/4.2 regression] ICE    |[4.2 regression] ICE with
                   |with default argument in    |default argument in template
                   |template template parameter |template parameter
   Target Milestone|4.1.3                       |4.2.5


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


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

* [Bug c++/30897] [4.2 regression] ICE with default argument in template template parameter
  2007-02-20 21:24 [Bug c++/30897] New: [4.1/4.2/4.3 regression] ICE with default argument in template template parameter reichelt at gcc dot gnu dot org
                   ` (8 preceding siblings ...)
  2008-07-04 21:59 ` [Bug c++/30897] [4.2 " jsm28 at gcc dot gnu dot org
@ 2009-03-30 21:38 ` jsm28 at gcc dot gnu dot org
  9 siblings, 0 replies; 11+ messages in thread
From: jsm28 at gcc dot gnu dot org @ 2009-03-30 21:38 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from jsm28 at gcc dot gnu dot org  2009-03-30 21:38 -------
Closing 4.2 branch, fixed in 4.3.


-- 

jsm28 at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
      Known to fail|                            |4.2.5
         Resolution|                            |FIXED
   Target Milestone|4.2.5                       |4.3.0


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


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

end of thread, other threads:[~2009-03-30 21:38 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-02-20 21:24 [Bug c++/30897] New: [4.1/4.2/4.3 regression] ICE with default argument in template template parameter reichelt at gcc dot gnu dot org
2007-02-20 21:41 ` [Bug c++/30897] " reichelt at gcc dot gnu dot org
2007-02-20 21:46 ` rguenth at gcc dot gnu dot org
2007-03-05  4:00 ` mmitchel at gcc dot gnu dot org
2007-03-23  0:50 ` mmitchel at gcc dot gnu dot org
2007-09-23 11:53 ` pcarlini at suse dot de
2007-10-29 19:17 ` jason at gcc dot gnu dot org
2007-11-02  5:50 ` jason at gcc dot gnu dot org
2007-11-02  5:58 ` [Bug c++/30897] [4.1/4.2 " jason at gcc dot gnu dot org
2008-07-04 21:59 ` [Bug c++/30897] [4.2 " jsm28 at gcc dot gnu dot org
2009-03-30 21:38 ` jsm28 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).