parser.c (cp_parser_primary_expression): See through explicitly scoped ALIAS_DECLs, too.

* parser.c (cp_parser_primary_expression): See through explicitly
        scoped ALIAS_DECLs, too.

From-SVN: r61054
This commit is contained in:
Jason Merrill 2003-01-08 15:00:17 -05:00 committed by Jason Merrill
parent 2d2a50c30a
commit f74dbcece0
3 changed files with 21 additions and 4 deletions

View file

@ -1,3 +1,8 @@
2003-01-08 Jason Merrill <jason@redhat.com>
* parser.c (cp_parser_primary_expression): See through explicitly
scoped ALIAS_DECLs, too.
2003-01-08 Nathanael Nerode <neroden@gcc.gnu.org>
* decl.c: ANSIfy function declarations.

View file

@ -3023,14 +3023,15 @@ cp_parser_primary_expression (cp_parser *parser,
if (TREE_CODE (decl) == FIELD_DECL || BASELINK_P (decl))
*qualifying_class = parser->scope;
}
/* Resolve references to variables of anonymous unions
into COMPONENT_REFs. */
else if (TREE_CODE (decl) == ALIAS_DECL)
decl = DECL_INITIAL (decl);
else
/* Transform references to non-static data members into
COMPONENT_REFs. */
decl = hack_identifier (decl, id_expression);
/* Resolve references to variables of anonymous unions
into COMPONENT_REFs. */
if (TREE_CODE (decl) == ALIAS_DECL)
decl = DECL_INITIAL (decl);
}
if (TREE_DEPRECATED (decl))

View file

@ -0,0 +1,11 @@
// Test that anonymous unions work with explicit scope.
static union
{
int i;
};
int main()
{
return ::i;
}