re PR c++/60379 (pugixml build failure caused by r207001)
authorJason Merrill <jason@redhat.com>
Sat, 1 Mar 2014 19:40:33 +0000 (14:40 -0500)
committerJason Merrill <jason@gcc.gnu.org>
Sat, 1 Mar 2014 19:40:33 +0000 (14:40 -0500)
PR c++/60379
* semantics.c (begin_maybe_infinite_loop): Use
fold_non_dependent_expr_sfinae.

From-SVN: r208247

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

index 939f5e18f02bd742777214fe114b5c0bee35ffc7..9e97f33b711460ad97bc9f4dd29a17f65e31df53 100644 (file)
@@ -1,3 +1,9 @@
+2014-03-01  Jason Merrill  <jason@redhat.com>
+
+       PR c++/60379
+       * semantics.c (begin_maybe_infinite_loop): Use
+       fold_non_dependent_expr_sfinae.
+
 2014-02-28  Jason Merrill  <jason@redhat.com>
 
        PR c++/58845
index 9c1c29d28e4e12e6dca19f729f0491975c70267a..eaeeb24b028fdd4289fda4fec2fe9e8b53573329 100644 (file)
@@ -503,7 +503,7 @@ begin_maybe_infinite_loop (tree cond)
   bool maybe_infinite = true;
   if (cond)
     {
-      cond = fold_non_dependent_expr (cond);
+      cond = fold_non_dependent_expr_sfinae (cond, tf_none);
       cond = maybe_constant_value (cond);
       maybe_infinite = integer_nonzerop (cond);
     }
diff --git a/gcc/testsuite/g++.dg/template/loop1.C b/gcc/testsuite/g++.dg/template/loop1.C
new file mode 100644 (file)
index 0000000..aa6d177
--- /dev/null
@@ -0,0 +1,9 @@
+// PR c++/60379
+
+template <int> struct A {
+  void m_fn1(int p1) {
+    int *a;
+    while (p1 && *static_cast<int *>(static_cast<void *>(a)))
+      ;
+  }
+};