* c-common.c (fold_offsetof_1): Handle static members.
* g++.dg/ext/offsetof1.C: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@114369
138bc75d-0d04-0410-961f-
82ee72b054a4
+2006-06-04 Volker Reichelt <reichelt@igpm.rwth-aachen.de>
+
+ PR c++/27601
+ * c-common.c (fold_offsetof_1): Handle static members.
+
2006-06-04 Eric Christopher <echristo@apple.com>
* stor-layout.c (start_record_layout): Initialize remaining_in_alignment.
case ERROR_MARK:
return expr;
+ case VAR_DECL:
+ error ("cannot apply %<offsetof%> to static data member %qD", expr);
+ return error_mark_node;
+
case INDIRECT_REF:
return size_zero_node;
+2006-06-04 Volker Reichelt <reichelt@igpm.rwth-aachen.de>
+
+ PR c++/27601
+ * g++.dg/ext/offsetof1.C: New test.
+
2006-06-04 Eric Christopher <echristo@apple.com>
* gcc.dg/attr-ms_struct-1.c: New.
--- /dev/null
+// PR c++/27601
+// Origin: Patrik Hägglund <patrik.hagglund@bredband.net>
+// { dg-do compile }
+
+struct bar {
+ static int foo;
+};
+
+int a = __builtin_offsetof(bar, foo); // { dg-error "static data member" }