From: Jason Merrill <jason@redhat.com>
To: gcc-patches List <gcc-patches@gcc.gnu.org>
Subject: C++ PATCH for c++/46277 (ICE in spec2k)
Date: Wed, 03 Nov 2010 15:30:00 -0000 [thread overview]
Message-ID: <4CD17D41.4060508@redhat.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 254 bytes --]
I'm a little concerned that we can't figure out which function is being
called in this case, since it isn't actually type-dependent, but since
this isn't in a constant expression it doesn't really matter.
Tested x86_64-pc-linux-gnu, applied to trunk.
[-- Attachment #2: 46277.patch --]
[-- Type: text/plain, Size: 1187 bytes --]
commit 7d13a58f7e3d2e0fa70c58cab5bb73b206998c00
Author: Jason Merrill <jason@redhat.com>
Date: Wed Nov 3 01:04:24 2010 -0400
PR c++/46277
* init.c (expand_default_init): Avoid ICE if we can't figure out
which function is being called.
diff --git a/gcc/cp/init.c b/gcc/cp/init.c
index d632816..982dc24 100644
--- a/gcc/cp/init.c
+++ b/gcc/cp/init.c
@@ -1443,7 +1443,7 @@ expand_default_init (tree binfo, tree true_exp, tree exp, tree init, int flags,
if (exp == true_exp && TREE_CODE (rval) == CALL_EXPR)
{
tree fn = get_callee_fndecl (rval);
- if (DECL_DECLARED_CONSTEXPR_P (fn))
+ if (fn && DECL_DECLARED_CONSTEXPR_P (fn))
{
tree e = maybe_constant_value (rval);
if (TREE_CONSTANT (e))
diff --git a/gcc/testsuite/g++.dg/template/new9.C b/gcc/testsuite/g++.dg/template/new9.C
new file mode 100644
index 0000000..24e40ee
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/new9.C
@@ -0,0 +1,16 @@
+// PR c++/46277
+
+class ggRGBE {
+public:
+ ggRGBE();
+};
+template <class T> class ggIO
+{
+ void readbody(int);
+ ggRGBE *scanline;
+};
+template <class T> void
+ggIO<T>::readbody(int width)
+{
+ scanline = new ggRGBE[width];
+}
reply other threads:[~2010-11-03 15:18 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=4CD17D41.4060508@redhat.com \
--to=jason@redhat.com \
--cc=gcc-patches@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).