public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "rjpeters at klab dot caltech dot edu" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/15329] New: ICE on constructor of member template
Date: Thu, 06 May 2004 18:36:00 -0000	[thread overview]
Message-ID: <20040506183602.15329.rjpeters@klab.caltech.edu> (raw)

This code produces an ICE with g++-3.4.0

class Canvas
{
public:
  typedef void (Canvas::* Manip)();

  template <Manip doit>
  class Saver
  {
  public:
    Saver(Canvas& canvas) :
      itsCanvas(canvas)
    {
      (itsCanvas.*doit)(); // ICE occurs here; no ICE if 'canvas' is used
instead of 'itsCanvas'
    }

  private:
    Canvas& itsCanvas;
  };
};


Specs:
[sideswipe 18:20 52]$ /usr/local/gcc-3.4.0/bin/g++ -v
Reading specs from /usr/local/gcc-3.4.0/lib/gcc/i686-pc-linux-gnu/3.4.0/specs
Configured with: /home/rjpeters/build/gcc-3.4.0/configure
--prefix=/usr/local/gcc-3.4.0 --enable-shared --enable-threads=posix
--disable-checking --with-system-zlib --enable-__cxa_atexit
Thread model: posix
gcc version 3.4.0

There is no ICE with g++-3.3.2 for the same code and as far as I can recall
there has been no problem with this same code as I upgraded through all
successive versions including 3.1.x, 3.2.x, and 3.3.x.

There is no ICE if the problem line uses the function argument 'canvas' rather
than the member variable 'itsCanvas' as the callee of the ptr-to-memfunc.

There is no ICE if the problem line is changed to a direct member-function call
rather than a call through a ptr-to-memfunc and in this case the nested class is
not a template class:

class Canvas
{
public:
  void foo();

  class Saver
  {
  public:
    Saver(Canvas& canvas) :
      itsCanvas(canvas)
    {
      itsCanvas.foo(); // no ICE here in this case
    }

  private:
    Canvas& itsCanvas;
  };
};

-Rob Peters

-- 
           Summary: ICE on constructor of member template
           Product: gcc
           Version: 3.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: rjpeters at klab dot caltech dot edu
                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=15329


             reply	other threads:[~2004-05-06 18:36 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-05-06 18:36 rjpeters at klab dot caltech dot edu [this message]
2004-05-06 18:48 ` [Bug c++/15329] [3.4/3.5 Regression] " pinskia at gcc dot gnu dot org
2004-05-06 21:28 ` bangerth at dealii dot org
2004-05-24  2:34 ` mmitchel at gcc dot gnu dot org
2004-05-25  0:37 ` cvs-commit at gcc dot gnu dot org
2004-05-25  0:46 ` cvs-commit at gcc dot gnu dot org
2004-05-25  1:04 ` cvs-commit at gcc dot gnu dot org
2004-05-25  1:05 ` mmitchel 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=20040506183602.15329.rjpeters@klab.caltech.edu \
    --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).