Commit 04e4dbd0 by Marek Polacek Committed by Marek Polacek

re PR c++/66572 (Bogus Wlogical-op warning for operands coming from template instantiations)

	PR c++/66572
	* pt.c (tsubst_copy_and_build): Add warn_logical_op sentinel.

	* g++.dg/warn/Wlogical-op-2.C: New test.

From-SVN: r226120
parent 45952786
2015-07-23 Marek Polacek <polacek@redhat.com>
PR c++/66572
* pt.c (tsubst_copy_and_build): Add warn_logical_op sentinel.
2015-07-23 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/52987
......
......@@ -14917,6 +14917,7 @@ tsubst_copy_and_build (tree t,
{
warning_sentinel s1(warn_type_limits);
warning_sentinel s2(warn_div_by_zero);
warning_sentinel s3(warn_logical_op);
tree op0 = RECUR (TREE_OPERAND (t, 0));
tree op1 = RECUR (TREE_OPERAND (t, 1));
tree r = build_x_binary_op
......
2015-07-23 Marek Polacek <polacek@redhat.com>
PR c++/66572
* g++.dg/warn/Wlogical-op-2.C: New test.
2015-07-23 Alexandre Oliva <aoliva@redhat.com>
PR rtl-optimization/64164
......
// PR c++/66572
// { dg-do compile { target c++11 } }
// { dg-options "-Wlogical-op" }
struct false_type
{
static constexpr bool value = false;
};
struct true_type
{
static constexpr bool value = true;
};
template<typename T>
struct is_unsigned : false_type {};
template<>
struct is_unsigned<unsigned> : true_type {};
template<typename T1, typename T2>
bool foo()
{
return is_unsigned<T1>::value && is_unsigned<T2>::value;
}
int main()
{
foo<unsigned, unsigned>();
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment