diff options
author | Ken Matsui <kmatsui@gcc.gnu.org> | 2023-12-06 21:32:58 -0800 |
---|---|---|
committer | Jason Merrill <jason@redhat.com> | 2023-12-10 13:11:22 -0500 |
commit | df3559d951ba6572e254a1bd1ef9a34b6e543325 (patch) | |
tree | efe4339cbc3111b99897841555ad756724f2cc6c /gcc/cp/constraint.cc | |
parent | 400cd0c26cf86fe75b0e4d42f9976b3125bcfd43 (diff) | |
download | gcc-df3559d951ba6572e254a1bd1ef9a34b6e543325.zip gcc-df3559d951ba6572e254a1bd1ef9a34b6e543325.tar.gz gcc-df3559d951ba6572e254a1bd1ef9a34b6e543325.tar.bz2 |
c++: Accept the use of built-in trait identifiers
This patch accepts the use of built-in trait identifiers when they are
actually not used as traits. Specifically, we check if the subsequent
token is '(' for ordinary built-in traits or is '<' only for the special
__type_pack_element built-in trait. If those identifiers are used
differently, the parser treats them as normal identifiers. This allows
us to accept code like: struct __is_pointer {};.
gcc/cp/ChangeLog:
* parser.cc (cp_lexer_lookup_trait): Rename to ...
(cp_lexer_peek_trait): ... this. Handle a subsequent token for
the corresponding built-in trait.
(cp_lexer_lookup_trait_expr): Rename to ...
(cp_lexer_peek_trait_expr): ... this.
(cp_lexer_lookup_trait_type): Rename to ...
(cp_lexer_peek_trait_type): ... this.
(cp_lexer_next_token_is_decl_specifier_keyword): Call
cp_lexer_peek_trait_type.
(cp_parser_simple_type_specifier): Likewise.
(cp_parser_primary_expression): Call cp_lexer_peek_trait_expr.
Signed-off-by: Ken Matsui <kmatsui@gcc.gnu.org>
Diffstat (limited to 'gcc/cp/constraint.cc')
0 files changed, 0 insertions, 0 deletions