+2004-06-01 Giovanni Bajo <giovannibajo@gcc.gnu.org>
+
+ PR c++/14932
+ * parser.c (cp_parser_postfix_expression): Allow subscript
+ operator in offsetof.
+
2004-05-31 Mark Mitchell <mark@codesourcery.com>
PR c++/15701
= grok_array_decl (postfix_expression, index);
idk = CP_ID_KIND_NONE;
/* Array references are not permitted in
- constant-expressions. */
- if (cp_parser_non_integral_constant_expression
- (parser, "an array reference"))
+ constant-expressions (but they are allowed
+ in offsetof). */
+ if (!parser->in_offsetof_p
+ && cp_parser_non_integral_constant_expression
+ (parser, "an array reference"))
postfix_expression = error_mark_node;
}
break;
--- /dev/null
+// { dg-do compile }
+// Contributed by Bill Helfinstine <bhelf at flitterfly dot whirpon dot com>
+// PR c++/14932: Allow subscript operator in offsetof
+
+#include <cstddef>
+
+struct A
+{
+ int bar;
+ int foo[22];
+};
+
+const int off = offsetof(A, foo[12]);