public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "foom at fuhm dot net" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/41863]  New: [4.5 Regression] segfault with sizeof in template parameter
Date: Thu, 29 Oct 2009 03:34:00 -0000	[thread overview]
Message-ID: <bug-41863-824@http.gcc.gnu.org/bugzilla/> (raw)

GCC 4.5 appears to fail when using sizeof(member-of-templated-type) inside a
template parameter.

I have tested the Debian gcc-snapshot 20090923-1 amd64 package, 20091010-1
i386, and Ubuntu gcc-snapshot 20091018-1 amd64. All exhibit the same behavior.
g++-4.4 works fine, however.

Changing to "sizeof(m_foo)" to "sizeof(T)" also fixes the problem.

File /tmp/test.cpp:
===CUT===
template<int X> struct Bar {
};

template<typename T>
class Foo {
    T m_foo;
    void crash() {
        Bar<sizeof(m_foo)> bar;
    }
};
===CUT===

$ g++ -c /tmp/test.cpp

/tmp/test.cpp: In member function 'void Foo<T>::crash()':
/tmp/test.cpp:8:26: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-snapshot/README.Bugs> for instructions.


-- 
           Summary: [4.5 Regression] segfault with sizeof in template
                    parameter
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: foom at fuhm dot net
  GCC host triplet: x86_64-linux-gnu
GCC target triplet: x86_64-linux-gnu


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


             reply	other threads:[~2009-10-29  3:34 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-29  3:34 foom at fuhm dot net [this message]
2009-10-29 10:26 ` [Bug c++/41863] " rguenth at gcc dot gnu dot org
2009-10-29 20:47 ` dodji at gcc dot gnu dot org
2009-10-29 22:56 ` dodji at gcc dot gnu dot org
2009-10-30  7:09 ` dodji at gcc dot gnu dot org
2009-10-30  7:09 ` dodji at gcc dot gnu dot org
2009-10-30 16:07 ` hjl 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=bug-41863-824@http.gcc.gnu.org/bugzilla/ \
    --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).