]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR c++/56895 (ICE: unexpected expression of kind arrow_expr)
authorJakub Jelinek <jakub@redhat.com>
Thu, 11 Apr 2013 19:42:33 +0000 (21:42 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Thu, 11 Apr 2013 19:42:33 +0000 (21:42 +0200)
PR c++/56895
* call.c (null_ptr_cst_p): Call fold_non_dependent_expr_sfinae before
calling maybe_constant_value for C++98.

* g++.dg/template/arrow4.C: New test.

From-SVN: r197824

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

index e2cf1b4bff133e8ecd68446048aa1fb40aa65783..a9e40c29022359d1ef4a5f2c0c819da7d16afb51 100644 (file)
@@ -1,3 +1,9 @@
+2013-04-11  Jakub Jelinek  <jakub@redhat.com>
+
+       PR c++/56895
+       * call.c (null_ptr_cst_p): Call fold_non_dependent_expr_sfinae before
+       calling maybe_constant_value for C++98.
+
 2013-04-11  Jason Merrill  <jason@redhat.com>
 
        PR c++/56901
index 4c59866323ee43bf1724fc4e13728e5d2c98810f..88bf1006c7bd5de3104796659e7847ada0002f50 100644 (file)
@@ -555,7 +555,7 @@ null_ptr_cst_p (tree t)
     {
       /* Core issue 903 says only literal 0 is a null pointer constant.  */
       if (cxx_dialect < cxx0x)
-       t = maybe_constant_value (t);
+       t = maybe_constant_value (fold_non_dependent_expr_sfinae (t, tf_none));
       STRIP_NOPS (t);
       if (integer_zerop (t) && !TREE_OVERFLOW (t))
        return true;
index 21b44e70b7354714fc4a0e5315196f56cc23d463..a3a517e177e843ee6b4aa6185c3915a036772085 100644 (file)
@@ -1,3 +1,8 @@
+2013-04-11  Jakub Jelinek  <jakub@redhat.com>
+
+       PR c++/56895
+       * g++.dg/template/arrow4.C: New test.
+
 2013-04-11  Eric Botcazou  <ebotcazou@adacore.com>
 
        * gnat.dg/array23.adb: New test.
diff --git a/gcc/testsuite/g++.dg/template/arrow4.C b/gcc/testsuite/g++.dg/template/arrow4.C
new file mode 100644 (file)
index 0000000..89e7822
--- /dev/null
@@ -0,0 +1,19 @@
+// PR c++/56895
+// { dg-do compile }
+
+void fn (int *);
+void fn (int);
+extern struct A { bool foo (); A bar (); } *a;
+
+template <int>
+void
+baz ()
+{
+  fn (a->bar().foo() ? 1 : 0);
+}
+
+void
+test ()
+{
+  baz<0> ();
+}