Commit 999a1ad4 by Mike Stump Committed by Mike Stump

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
parent 85fd2947
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> 2004-07-09 Giovanni Bajo <giovannibajo@gcc.gnu.org>
PR c++/8211 PR c++/8211
......
...@@ -1707,7 +1707,8 @@ build_class_member_access_expr (tree object, tree member, ...@@ -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 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. */ point. So we just give a warning, instead of a pedwarn. */
if (null_object_p && warn_invalid_offsetof 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", warning ("invalid access to non-static data member `%D' of NULL object",
member); member);
......
// { dg-do compile }
class Foo {
int children[4];
public:
unsigned function(void) {
return sizeof (((Foo*)0)->children);
}
};
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