typeck.c (build_class_member_access_expr): Skip null deref warning when we don't dereference it.
* typeck.c (build_class_member_access_expr): Skip null deref warning when we don't dereference it. Radar 3718909 From-SVN: r84389
This commit is contained in:
parent
85fd2947bd
commit
999a1ad4ec
@ -1,3 +1,8 @@
|
||||
2004-07-09 Mike Stump <mrs@apple.com>
|
||||
|
||||
* typeck.c (build_class_member_access_expr): Skip null deref
|
||||
warning when we don't dereference it.
|
||||
|
||||
2004-07-09 Giovanni Bajo <giovannibajo@gcc.gnu.org>
|
||||
|
||||
PR c++/8211
|
||||
|
@ -1707,7 +1707,8 @@ build_class_member_access_expr (tree object, tree member,
|
||||
actually used the offsetof macro, since there's no way to know at this
|
||||
point. So we just give a warning, instead of a pedwarn. */
|
||||
if (null_object_p && warn_invalid_offsetof
|
||||
&& CLASSTYPE_NON_POD_P (object_type))
|
||||
&& CLASSTYPE_NON_POD_P (object_type)
|
||||
&& ! skip_evaluation)
|
||||
{
|
||||
warning ("invalid access to non-static data member `%D' of NULL object",
|
||||
member);
|
||||
|
9
gcc/testsuite/g++.old-deja/g++.mike/sizeof.C
Normal file
9
gcc/testsuite/g++.old-deja/g++.mike/sizeof.C
Normal file
@ -0,0 +1,9 @@
|
||||
// { dg-do compile }
|
||||
|
||||
class Foo {
|
||||
int children[4];
|
||||
public:
|
||||
unsigned function(void) {
|
||||
return sizeof (((Foo*)0)->children);
|
||||
}
|
||||
};
|
Loading…
Reference in New Issue
Block a user