diff options
author | Jason Merrill <jason@redhat.com> | 2010-10-27 17:43:33 -0400 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2010-10-27 17:43:33 -0400 |
commit | 2b08f2c561e0dc9b8f569a00868a6b7eb2ba111b (patch) | |
tree | f2bb18bbab464000b24772c45a3ad35f319b284b /gcc/cp | |
parent | 81f0bab25ec7d17b84e94ee7322aa953a75584a7 (diff) | |
download | gcc-2b08f2c561e0dc9b8f569a00868a6b7eb2ba111b.zip gcc-2b08f2c561e0dc9b8f569a00868a6b7eb2ba111b.tar.gz gcc-2b08f2c561e0dc9b8f569a00868a6b7eb2ba111b.tar.bz2 |
c-common.c (c_common_reswords): Add __is_literal_type.
gcc/c-family/
* c-common.c (c_common_reswords): Add __is_literal_type.
* c-common.h (enum rid): Add RID_IS_LITERAL_TYPE.
gcc/cp/
* cp-tree.h (cp_trait_kind): Add CPTK_IS_LITERAL_TYPE.
* cxx-pretty-print.c (pp_cxx_trait_expression): Handle it.
* semantics.c (trait_expr_value, finish_trait_expr): Likewise.
* parser.c (cp_parser_primary_expression): Handle RID_IS_LITERAL_TYPE.
(cp_parser_trait_expr): Likewise.
libstdc++-v3/
* include/std/type_traits (is_literal_type): New.
From-SVN: r166020
Diffstat (limited to 'gcc/cp')
-rw-r--r-- | gcc/cp/ChangeLog | 8 | ||||
-rw-r--r-- | gcc/cp/cp-tree.h | 1 | ||||
-rw-r--r-- | gcc/cp/cxx-pretty-print.c | 3 | ||||
-rw-r--r-- | gcc/cp/parser.c | 4 | ||||
-rw-r--r-- | gcc/cp/semantics.c | 5 |
5 files changed, 21 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 6efa96a..8a94ad0 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,11 @@ +2010-10-27 Jason Merrill <jason@redhat.com> + + * cp-tree.h (cp_trait_kind): Add CPTK_IS_LITERAL_TYPE. + * cxx-pretty-print.c (pp_cxx_trait_expression): Handle it. + * semantics.c (trait_expr_value, finish_trait_expr): Likewise. + * parser.c (cp_parser_primary_expression): Handle RID_IS_LITERAL_TYPE. + (cp_parser_trait_expr): Likewise. + 2010-10-27 Gabriel Dos Reis <gdr@cse.tamu.edu> Jason Merrill <jason@redhat.com> diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index 1cd776a..7595b6f 100644 --- a/gcc/cp/cp-tree.h +++ b/gcc/cp/cp-tree.h @@ -567,6 +567,7 @@ typedef enum cp_trait_kind CPTK_IS_POLYMORPHIC, CPTK_IS_STD_LAYOUT, CPTK_IS_TRIVIAL, + CPTK_IS_LITERAL_TYPE, CPTK_IS_UNION } cp_trait_kind; diff --git a/gcc/cp/cxx-pretty-print.c b/gcc/cp/cxx-pretty-print.c index bbef227..09fcc49 100644 --- a/gcc/cp/cxx-pretty-print.c +++ b/gcc/cp/cxx-pretty-print.c @@ -2369,6 +2369,9 @@ pp_cxx_trait_expression (cxx_pretty_printer *pp, tree t) case CPTK_IS_UNION: pp_cxx_ws_string (pp, "__is_union"); break; + case CPTK_IS_LITERAL_TYPE: + pp_cxx_ws_string (pp, "__is_literal_type"); + break; default: gcc_unreachable (); diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index 0d28345..360e197 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -3814,6 +3814,7 @@ cp_parser_primary_expression (cp_parser *parser, case RID_IS_STD_LAYOUT: case RID_IS_TRIVIAL: case RID_IS_UNION: + case RID_IS_LITERAL_TYPE: return cp_parser_trait_expr (parser, token->keyword); /* Objective-C++ expressions. */ @@ -7365,6 +7366,9 @@ cp_parser_trait_expr (cp_parser* parser, enum rid keyword) case RID_IS_UNION: kind = CPTK_IS_UNION; break; + case RID_IS_LITERAL_TYPE: + kind = CPTK_IS_LITERAL_TYPE; + break; default: gcc_unreachable (); } diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c index 0ca8c339..5926963 100644 --- a/gcc/cp/semantics.c +++ b/gcc/cp/semantics.c @@ -5104,6 +5104,9 @@ trait_expr_value (cp_trait_kind kind, tree type1, tree type2) case CPTK_IS_UNION: return (type_code1 == UNION_TYPE); + case CPTK_IS_LITERAL_TYPE: + return (literal_type_p (type1)); + default: gcc_unreachable (); return false; @@ -5152,6 +5155,7 @@ finish_trait_expr (cp_trait_kind kind, tree type1, tree type2) || kind == CPTK_IS_POLYMORPHIC || kind == CPTK_IS_STD_LAYOUT || kind == CPTK_IS_TRIVIAL + || kind == CPTK_IS_LITERAL_TYPE || kind == CPTK_IS_UNION); if (kind == CPTK_IS_CONVERTIBLE_TO) @@ -5195,6 +5199,7 @@ finish_trait_expr (cp_trait_kind kind, tree type1, tree type2) case CPTK_IS_POLYMORPHIC: case CPTK_IS_STD_LAYOUT: case CPTK_IS_TRIVIAL: + case CPTK_IS_LITERAL_TYPE: if (!check_trait_type (type1)) { error ("incomplete type %qT not allowed", type1); |