Skip to content

Commit 1774df3

Browse files
author
miyuki
committed
PR c++/65882
gcc/cp/ * call.c (build_new_op_1): Check tf_warning flag in all cases. gcc/testsuite/ * g++.dg/diagnostic/inhibit-warn-1.C: New test. * g++.dg/diagnostic/inhibit-warn-2.C: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@224702 138bc75d-0d04-0410-961f-82ee72b054a4
1 parent 286710f commit 1774df3

File tree

5 files changed

+85
-4
lines changed

5 files changed

+85
-4
lines changed

gcc/cp/ChangeLog

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
2015-06-20 Mikhail Maltsev <[email protected]>
2+
3+
PR c++/65882
4+
* call.c (build_new_op_1): Check tf_warning flag in all cases.
5+
16
2015-06-19 Jason Merrill <[email protected]>
27

38
PR c++/66585

gcc/cp/call.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5640,17 +5640,19 @@ build_new_op_1 (location_t loc, enum tree_code code, int flags, tree arg1,
56405640
case TRUTH_ORIF_EXPR:
56415641
case TRUTH_AND_EXPR:
56425642
case TRUTH_OR_EXPR:
5643-
warn_logical_operator (loc, code, boolean_type_node,
5644-
code_orig_arg1, arg1, code_orig_arg2, arg2);
5643+
if (complain & tf_warning)
5644+
warn_logical_operator (loc, code, boolean_type_node,
5645+
code_orig_arg1, arg1, code_orig_arg2, arg2);
56455646
/* Fall through. */
56465647
case GT_EXPR:
56475648
case LT_EXPR:
56485649
case GE_EXPR:
56495650
case LE_EXPR:
56505651
case EQ_EXPR:
56515652
case NE_EXPR:
5652-
if ((code_orig_arg1 == BOOLEAN_TYPE)
5653-
^ (code_orig_arg2 == BOOLEAN_TYPE))
5653+
if ((complain & tf_warning)
5654+
&& ((code_orig_arg1 == BOOLEAN_TYPE)
5655+
^ (code_orig_arg2 == BOOLEAN_TYPE)))
56545656
maybe_warn_bool_compare (loc, code, arg1, arg2);
56555657
/* Fall through. */
56565658
case PLUS_EXPR:

gcc/testsuite/ChangeLog

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
2015-06-20 Mikhail Maltsev <[email protected]>
2+
3+
PR c++/65882
4+
* g++.dg/diagnostic/inhibit-warn-1.C: New test.
5+
* g++.dg/diagnostic/inhibit-warn-2.C: New test.
6+
17
2015-06-19 Eric Botcazou <[email protected]>
28

39
* gnat.dg/specs/debug1.ads: Adjust.
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
// PR c++/65882
2+
// { dg-do compile { target c++11 } }
3+
// { dg-options "-Wbool-compare" }
4+
5+
// Check that we don't ICE because of reentering error reporting routines while
6+
// evaluating template parameters
7+
8+
template<typename>
9+
struct type_function {
10+
static constexpr bool value = false;
11+
};
12+
13+
template<bool>
14+
struct dependent_type {
15+
typedef int type;
16+
};
17+
18+
template<typename T>
19+
typename dependent_type<(5 > type_function<T>::value)>::type
20+
bar();
21+
22+
template<typename T>
23+
typename dependent_type<(5 > type_function<T>::value)>::type
24+
foo()
25+
{
26+
return bar<int>();
27+
}
28+
29+
int main()
30+
{
31+
foo<int>();
32+
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
// PR c++/65882
2+
// PR c++/66467
3+
// { dg-do compile }
4+
5+
template <bool>
6+
struct A
7+
{
8+
typedef int type;
9+
};
10+
11+
struct B
12+
{
13+
static const int value = 0;
14+
};
15+
16+
template <class>
17+
struct C
18+
{
19+
typedef int type;
20+
};
21+
22+
template <class>
23+
struct F : B {};
24+
25+
class D
26+
{
27+
template <class Expr>
28+
typename A<F<typename C<Expr>::type>::value || B::value>::type
29+
operator=(Expr); // { dg-message "declared" }
30+
};
31+
32+
void fn1()
33+
{
34+
D opt;
35+
opt = 0; // { dg-error "private" }
36+
}

0 commit comments

Comments
 (0)