PR c++/89973 - -Waddress-of-packed-member ICE with invalid conversion.

PR c++/89973 - -Waddress-of-packed-member ICE with invalid conversion. 
	* c-warn.c (check_address_or_pointer_of_packed_member): Check the type
	of RHS.

	* g++.dg/warn/Waddress-of-packed-member2.C: New test.

From-SVN: r270166
This commit is contained in:
Marek Polacek 2019-04-05 14:56:53 +00:00 committed by Marek Polacek
parent 25eafae67f
commit 05564120c6
4 changed files with 19 additions and 1 deletions

View File

@ -1,3 +1,9 @@
2019-04-05 Marek Polacek <polacek@redhat.com>
PR c++/89973 - -Waddress-of-packed-member ICE with invalid conversion.
* c-warn.c (check_address_or_pointer_of_packed_member): Check the type
of RHS.
2019-04-03 Jason Merrill <jason@redhat.com>
PR c++/86586 - -fcompare-debug=-Wsign-compare.

View File

@ -2769,7 +2769,7 @@ check_address_or_pointer_of_packed_member (tree type, tree rhs)
rhs = TREE_TYPE (rhs); /* Pointer type. */
rhs = TREE_TYPE (rhs); /* Function type. */
rhstype = TREE_TYPE (rhs);
if (!POINTER_TYPE_P (rhstype))
if (!rhstype || !POINTER_TYPE_P (rhstype))
return NULL_TREE;
rvalue = true;
}

View File

@ -1,3 +1,8 @@
2019-04-05 Marek Polacek <polacek@redhat.com>
PR c++/89973 - -Waddress-of-packed-member ICE with invalid conversion.
* g++.dg/warn/Waddress-of-packed-member2.C: New test.
2019-04-05 Richard Biener <rguenther@suse.de>
PR debug/89892

View File

@ -0,0 +1,7 @@
// PR c++/89973
// { dg-do compile { target c++14 } }
constexpr int a(); // { dg-warning "used but never defined" }
template <typename>
constexpr void *b = a(); // { dg-error "invalid conversion" }