+2015-08-17 Iain Buclaw <ibuclaw@gdcproject.org>
+
+ * d-exp.y (type_aggregate_p): New function.
+ (PrimaryExpression : TypeExp '.' IdentifierExp): Use it.
+ (classify_inner_name): Likewise.
+ * d-namespace.c (d_lookup_nested_symbol): Handle TYPE_CODE_ENUM.
+
2015-08-15 Doug Evans <xdje42@gmail.com>
* psymtab.c (add_psymbol_to_bcache): Remove "val" arg. All callers
void yyerror (char *);
+static int type_aggregate_p (struct type *);
+
%}
/* Although the yacc "value" of an expression is not used,
/* Check if the qualified name resolves as a member
of an aggregate or an enum type. */
- if (!(TYPE_CODE (type) == TYPE_CODE_STRUCT
- || TYPE_CODE (type) == TYPE_CODE_UNION
- || TYPE_CODE (type) == TYPE_CODE_ENUM))
+ if (!type_aggregate_p (type))
error (_("`%s' is not defined as an aggregate type."),
TYPE_SAFE_NAME (type));
%%
+/* Return true if the type is aggregate-like. */
+
+static int
+type_aggregate_p (struct type *type)
+{
+ return (TYPE_CODE (type) == TYPE_CODE_STRUCT
+ || TYPE_CODE (type) == TYPE_CODE_UNION
+ || (TYPE_CODE (type) == TYPE_CODE_ENUM
+ && TYPE_DECLARED_CLASS (type)));
+}
+
/* Take care of parsing a number (anything that starts with a digit).
Set yylval and return the token type; update lexptr.
LEN is the number of characters in it. */
return classify_name (par_state, block);
type = check_typedef (context);
+ if (!type_aggregate_p (type))
+ return ERROR;
copy = copy_name (yylval.ssym.stoken);
yylval.ssym.sym = d_lookup_nested_symbol (type, copy, block);