Commit 457d0ace by Paolo Carlini

re PR c++/64877 (strange warning message from -Waddress)

/cp
2015-02-03  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/64877
	* typeck.c (cp_build_binary_op): Avoid spurious -Waddress warnings
	for generated expressions.

/testsuite
2015-02-03  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/64877
	* g++.dg/warn/Waddress-2.C: New.

From-SVN: r220374
parent 2cb844ce
2015-02-03 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/64877
* typeck.c (cp_build_binary_op): Avoid spurious -Waddress warnings
for generated expressions.
2015-02-02 Ville Voutilainen <ville.voutilainen@gmail.com>
PR c++/64901
......
......@@ -4415,7 +4415,8 @@ cp_build_binary_op (location_t location,
&& decl_with_nonnull_addr_p (TREE_OPERAND (op0, 0)))
{
if ((complain & tf_warning)
&& c_inhibit_evaluation_warnings == 0)
&& c_inhibit_evaluation_warnings == 0
&& !TREE_NO_WARNING (op0))
warning (OPT_Waddress, "the address of %qD will never be NULL",
TREE_OPERAND (op0, 0));
}
......@@ -4436,7 +4437,8 @@ cp_build_binary_op (location_t location,
&& decl_with_nonnull_addr_p (TREE_OPERAND (op1, 0)))
{
if ((complain & tf_warning)
&& c_inhibit_evaluation_warnings == 0)
&& c_inhibit_evaluation_warnings == 0
&& !TREE_NO_WARNING (op1))
warning (OPT_Waddress, "the address of %qD will never be NULL",
TREE_OPERAND (op1, 0));
}
......@@ -4537,6 +4539,9 @@ cp_build_binary_op (location_t location,
op1 = save_expr (op1);
pfn0 = pfn_from_ptrmemfunc (op0);
/* Avoid -Waddress warnings (c++/64877). */
if (TREE_CODE (pfn0) == ADDR_EXPR)
TREE_NO_WARNING (pfn0) = 1;
pfn1 = pfn_from_ptrmemfunc (op1);
delta0 = delta_from_ptrmemfunc (op0);
delta1 = delta_from_ptrmemfunc (op1);
......
2015-02-03 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/64877
* g++.dg/warn/Waddress-2.C: New.
2015-02-03 Segher Boessenkool <segher@kernel.crashing.org>
PR middle-end/61225
gcc.target/i386/pr49095.c: XFAIL for ia32.
* gcc.target/i386/pr49095.c: XFAIL for ia32.
2015-02-03 <dodji@redhat.com>
2015-02-03 Dodji Seketeli <dodji@redhat.com>
PR preprocessor/64803
* gcc.dg/cpp/builtin-macro-1.c: New test case.
......
// PR c++/64877
// { dg-options "-Waddress" }
template<class Derived>
struct S
{
void m() {
}
S()
{
if (&S<Derived>::Unwrap != &Derived::Unwrap)
m();
}
void Unwrap() {
}
};
struct T : public S<T>
{
};
T t;
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