[C++ PATCH] C++0x scoped enumerations

Jason Merrill jason@redhat.com
Wed Aug 27 15:55:00 GMT 2008


> +lookup_enumerator (tree enumtype, tree name)
> +{
> +  tree e;
> +  gcc_assert (enumtype && TREE_CODE (enumtype) == ENUMERAL_TYPE);
> +
> +  for (e = TYPE_VALUES (enumtype); e; e = TREE_CHAIN (e))
> +    {
> +      if (TREE_PURPOSE (e) == name)
> +        return TREE_VALUE (e);
> +    }

Please use purpose_member here.

> +/* Parse the qualifying entity in a nested-namesspecifier. For C++98,

Missing a -.

> +      /* In C++0x, parse the optional `struct' or `class' key.  */
> +      if (cxx_dialect != cxx98
> +          && (cp_lexer_next_token_is_keyword (parser->lexer, RID_CLASS)
> +              || cp_lexer_next_token_is_keyword (parser->lexer, RID_STRUCT)))
> +        cp_lexer_consume_token (parser->lexer);

Please parse it in C++98 mode as well and then complain so people know 
that it's implemented, they just need to give the right flag.  Ditto 
with the underlying type.	

Jason



More information about the Gcc-patches mailing list