diff options
author | Patrick Palka <ppalka@redhat.com> | 2022-09-29 09:18:40 -0400 |
---|---|---|
committer | Patrick Palka <ppalka@redhat.com> | 2022-09-29 09:18:40 -0400 |
commit | 9ca147154074a0de548138b4e73477e94903a855 (patch) | |
tree | 689d3428db5ceea4aa86f800a8d59a1c8e9d300c /gcc/c-family/c-common.cc | |
parent | 817e878a31671fcb68492bce35aa1ac87e08efdb (diff) | |
download | gcc-9ca147154074a0de548138b4e73477e94903a855.zip gcc-9ca147154074a0de548138b4e73477e94903a855.tar.gz gcc-9ca147154074a0de548138b4e73477e94903a855.tar.bz2 |
c++: implement __remove_cv, __remove_reference and __remove_cvref
This implements builtins for std::remove_cv, std::remove_reference and
std::remove_cvref using TRAIT_TYPE from the previous patch.
gcc/c-family/ChangeLog:
* c-common.cc (c_common_reswords): Add __remove_cv,
__remove_reference and __remove_cvref.
* c-common.h (enum rid): Add RID_REMOVE_CV, RID_REMOVE_REFERENCE
and RID_REMOVE_CVREF.
gcc/cp/ChangeLog:
* constraint.cc (diagnose_trait_expr): Handle CPTK_REMOVE_CV,
CPTK_REMOVE_REFERENCE and CPTK_REMOVE_CVREF.
* cp-objcp-common.cc (names_builtin_p): Likewise.
* cp-tree.h (enum cp_trait_kind): Add CPTK_REMOVE_CV,
CPTK_REMOVE_REFERENCE and CPTK_REMOVE_CVREF.
* cxx-pretty-print.cc (pp_cxx_trait): Handle CPTK_REMOVE_CV,
CPTK_REMOVE_REFERENCE and CPTK_REMOVE_CVREF.
* parser.cc (cp_keyword_starts_decl_specifier_p): Return true
for RID_REMOVE_CV, RID_REMOVE_REFERENCE and RID_REMOVE_CVREF.
(cp_parser_trait): Handle RID_REMOVE_CV, RID_REMOVE_REFERENCE
and RID_REMOVE_CVREF.
(cp_parser_simple_type_specifier): Likewise.
* semantics.cc (finish_trait_type): Likewise.
libstdc++-v3/ChangeLog:
* include/bits/unique_ptr.h (unique_ptr<_Tp[], _Dp>): Remove
__remove_cv and use __remove_cv_t instead.
gcc/testsuite/ChangeLog:
* g++.dg/ext/has-builtin-1.C: Test existence of __remove_cv,
__remove_reference and __remove_cvref.
* g++.dg/ext/remove_cv.C: New test.
* g++.dg/ext/remove_reference.C: New test.
* g++.dg/ext/remove_cvref.C: New test.
Diffstat (limited to 'gcc/c-family/c-common.cc')
-rw-r--r-- | gcc/c-family/c-common.cc | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/gcc/c-family/c-common.cc b/gcc/c-family/c-common.cc index cda6910..6e0af86 100644 --- a/gcc/c-family/c-common.cc +++ b/gcc/c-family/c-common.cc @@ -547,6 +547,9 @@ const struct c_common_resword c_common_reswords[] = D_CXXONLY }, { "__reference_converts_from_temporary", RID_REF_CONVERTS_FROM_TEMPORARY, D_CXXONLY }, + { "__remove_cv", RID_REMOVE_CV, D_CXXONLY }, + { "__remove_reference", RID_REMOVE_REFERENCE, D_CXXONLY }, + { "__remove_cvref", RID_REMOVE_CVREF, D_CXXONLY }, /* C++ transactional memory. */ { "synchronized", RID_SYNCHRONIZED, D_CXX_OBJC | D_TRANSMEM }, |