* typeck.c (build_class_member_access_expr): Skip null deref
warning when we don't dereference it.
Radar
3718909
From-SVN: r84389
+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
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);
--- /dev/null
+// { dg-do compile }
+
+class Foo {
+ int children[4];
+public:
+ unsigned function(void) {
+ return sizeof (((Foo*)0)->children);
+ }
+};