aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarek Polacek <polacek@redhat.com>2019-10-11 20:44:02 +0000
committerMarek Polacek <mpolacek@gcc.gnu.org>2019-10-11 20:44:02 +0000
commitc6c3f55699d316da38496de1328f6e09a46deed8 (patch)
treef3138d560c12a55888dfb3704380ec81964e0267
parent436103a09831b2924d3262c13a17da530f90da92 (diff)
downloadgcc-c6c3f55699d316da38496de1328f6e09a46deed8.zip
gcc-c6c3f55699d316da38496de1328f6e09a46deed8.tar.gz
gcc-c6c3f55699d316da38496de1328f6e09a46deed8.tar.bz2
PR c++/92049 - extra error with -fchecking=2.
The concepts merge brought this bit @@ -26326,9 +26559,9 @@ build_non_dependent_expr (tree expr) unexpected recursive instantiations. */ && !parsing_nsdmi () /* Don't do this during concept expansion either and for - the same reason. */ - && !expanding_concept ()) - fold_non_dependent_expr (expr, tf_none); + the same reason. */ + && !parsing_constraint_expression_p ()) + fold_non_dependent_expr (expr); STRIP_ANY_LOCATION_WRAPPER (expr); (which I'm not finding in the ChangeLog). Dropping tf_none means that fold_non_dependent_expr will use tf_warning_or_error by default, and in this test that causes an error: template<bool> struct cond; template<int> struct S { void f(int i) { cond<__builtin_constant_p(i)>(); } }; S<1> s; where it complains that cond<false> is incomplete. Which it is, but we're not actually instantiating the function f, so issuing an error seems overzealous (though not wrong), and it breaks a bunch of tests. This patch brings that tf_none back. We will still complain if we do instantiate f. * pt.c (build_non_dependent_expr): Call fold_non_dependent_expr with tf_none. * g++.dg/template/builtin2.C: New test. From-SVN: r276906
-rw-r--r--gcc/cp/ChangeLog6
-rw-r--r--gcc/cp/pt.c2
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/g++.dg/template/builtin2.C5
4 files changed, 17 insertions, 1 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 49fb50d..02a330d 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,9 @@
+2019-10-11 Marek Polacek <polacek@redhat.com>
+
+ PR c++/92049 - extra error with -fchecking=2.
+ * pt.c (build_non_dependent_expr): Call fold_non_dependent_expr
+ with tf_none.
+
2019-10-11 Paolo Carlini <paolo.carlini@oracle.com>
* typeck.c (cp_build_binary_op): Do not handle RROTATE_EXPR and
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index 7fecc03..773eb43 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -27059,7 +27059,7 @@ build_non_dependent_expr (tree expr)
/* Don't do this during concept processing either and for
the same reason. */
&& !processing_constraint_expression_p ())
- fold_non_dependent_expr (expr);
+ fold_non_dependent_expr (expr, tf_none);
STRIP_ANY_LOCATION_WRAPPER (expr);
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index cc1a57b..bbcea40 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2019-10-11 Marek Polacek <polacek@redhat.com>
+
+ PR c++/92049 - extra error with -fchecking=2.
+ * g++.dg/template/builtin2.C: New test.
+
2019-10-11 Jim Wilson <jimw@sifive.com>
PR rtl-optimization/91860
diff --git a/gcc/testsuite/g++.dg/template/builtin2.C b/gcc/testsuite/g++.dg/template/builtin2.C
new file mode 100644
index 0000000..4e9089a
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/builtin2.C
@@ -0,0 +1,5 @@
+// PR c++/92049 - extra error with -fchecking=2.
+// { dg-do compile { target c++11 } }
+// { dg-additional-options "-fchecking=2" }
+
+#include "builtin1.C"