PKGBUILDs/core/gcc/pr65882.patch

107 lines
2.6 KiB
Diff
Raw Normal View History

2015-06-29 12:17:57 +00:00
Index: gcc/testsuite/g++.dg/diagnostic/inhibit-warn-1.C
===================================================================
--- gcc/testsuite/g++.dg/diagnostic/inhibit-warn-1.C (revision 0)
+++ gcc/testsuite/g++.dg/diagnostic/inhibit-warn-1.C (revision 224864)
2015-05-22 00:54:49 +00:00
@@ -0,0 +1,32 @@
+// PR c++/65882
+// { dg-do compile { target c++11 } }
+// { dg-options "-Wbool-compare" }
+
+// Check that we don't ICE because of reentering error reporting routines while
+// evaluating template parameters
+
+template<typename>
+struct type_function {
+ static constexpr bool value = false;
+};
+
+template<bool>
+struct dependent_type {
+ typedef int type;
+};
+
+template<typename T>
+typename dependent_type<(5 > type_function<T>::value)>::type
+bar();
+
+template<typename T>
+typename dependent_type<(5 > type_function<T>::value)>::type
+foo()
+{
+ return bar<int>();
+}
+
+int main()
+{
+ foo<int>();
+}
2015-06-29 12:17:57 +00:00
Index: gcc/testsuite/g++.dg/diagnostic/inhibit-warn-2.C
===================================================================
--- gcc/testsuite/g++.dg/diagnostic/inhibit-warn-2.C (revision 0)
+++ gcc/testsuite/g++.dg/diagnostic/inhibit-warn-2.C (revision 224864)
@@ -0,0 +1,36 @@
+// PR c++/65882
+// PR c++/66467
+// { dg-do compile }
+
+template <bool>
+struct A
+{
+ typedef int type;
+};
+
+struct B
+{
+ static const int value = 0;
+};
+
+template <class>
+struct C
+{
+ typedef int type;
+};
+
+template <class>
+struct F : B {};
+
+class D
+{
+ template <class Expr>
+ typename A<F<typename C<Expr>::type>::value || B::value>::type
+ operator=(Expr); // { dg-message "declared" }
+};
+
+void fn1()
+{
+ D opt;
+ opt = 0; // { dg-error "private" }
+}
Index: gcc/cp/call.c
===================================================================
--- gcc/cp/call.c (revision 224863)
+++ gcc/cp/call.c (revision 224864)
@@ -5687,8 +5687,9 @@
case TRUTH_ORIF_EXPR:
case TRUTH_AND_EXPR:
case TRUTH_OR_EXPR:
- warn_logical_operator (loc, code, boolean_type_node,
- code_orig_arg1, arg1, code_orig_arg2, arg2);
+ if (complain & tf_warning)
+ warn_logical_operator (loc, code, boolean_type_node,
+ code_orig_arg1, arg1, code_orig_arg2, arg2);
/* Fall through. */
case GT_EXPR:
case LT_EXPR:
@@ -5696,8 +5697,9 @@
case LE_EXPR:
case EQ_EXPR:
case NE_EXPR:
- if ((code_orig_arg1 == BOOLEAN_TYPE)
- ^ (code_orig_arg2 == BOOLEAN_TYPE))
+ if ((complain & tf_warning)
+ && ((code_orig_arg1 == BOOLEAN_TYPE)
+ ^ (code_orig_arg2 == BOOLEAN_TYPE)))
maybe_warn_bool_compare (loc, code, arg1, arg2);
/* Fall through. */
case PLUS_EXPR: