public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "mmitchel at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/30897] [4.1/4.2/4.3 regression] ICE with default argument in template template parameter
Date: Fri, 23 Mar 2007 00:50:00 -0000	[thread overview]
Message-ID: <20070323005025.31314.qmail@sourceware.org> (raw)
In-Reply-To: <bug-30897-1771@http.gcc.gnu.org/bugzilla/>



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


  parent reply	other threads:[~2007-03-23  0:50 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-02-20 21:24 [Bug c++/30897] New: " 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 [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070323005025.31314.qmail@sourceware.org \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).