re PR c++/46277 (Revision 166167 failed to build 252.eon in SPEC CPU 2000)
authorJason Merrill <jason@redhat.com>
Wed, 3 Nov 2010 15:33:05 +0000 (11:33 -0400)
committerJason Merrill <jason@gcc.gnu.org>
Wed, 3 Nov 2010 15:33:05 +0000 (11:33 -0400)
PR c++/46277
* init.c (expand_default_init): Avoid ICE if we can't figure out
which function is being called.

From-SVN: r166254

gcc/cp/ChangeLog
gcc/cp/init.c
gcc/testsuite/g++.dg/template/new9.C [new file with mode: 0644]

index 24783f5c4358bc9f6e1ec12a56faa845416f201a..34996fc47bd994eb7ba4c6fa492c66a08683471f 100644 (file)
@@ -1,3 +1,9 @@
+2010-11-03  Jason Merrill  <jason@redhat.com>
+
+       PR c++/46277
+       * init.c (expand_default_init): Avoid ICE if we can't figure out
+       which function is being called.
+
 2010-11-02  Nathan Froyd  <froydnj@codesourcery.com>
 
        * class.c (build_base_path, add_vcall_offset): Use build_zero_cst
index 1f73d148ac1e5fa866b31c7841599a5e4e9808c9..ab834bf65efbed35008d19830dc8073e41078504 100644 (file)
@@ -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 (file)
index 0000000..24e40ee
--- /dev/null
@@ -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];
+}