aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/cp-objcp-common.cc
diff options
context:
space:
mode:
authorPatrick Palka <ppalka@redhat.com>2022-09-29 09:18:40 -0400
committerPatrick Palka <ppalka@redhat.com>2022-09-29 09:18:40 -0400
commit9ca147154074a0de548138b4e73477e94903a855 (patch)
tree689d3428db5ceea4aa86f800a8d59a1c8e9d300c /gcc/cp/cp-objcp-common.cc
parent817e878a31671fcb68492bce35aa1ac87e08efdb (diff)
downloadgcc-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/cp/cp-objcp-common.cc')
-rw-r--r--gcc/cp/cp-objcp-common.cc3
1 files changed, 3 insertions, 0 deletions
diff --git a/gcc/cp/cp-objcp-common.cc b/gcc/cp/cp-objcp-common.cc
index 380f288..2d3f206 100644
--- a/gcc/cp/cp-objcp-common.cc
+++ b/gcc/cp/cp-objcp-common.cc
@@ -467,6 +467,9 @@ names_builtin_p (const char *name)
case RID_IS_NOTHROW_CONVERTIBLE:
case RID_REF_CONSTRUCTS_FROM_TEMPORARY:
case RID_REF_CONVERTS_FROM_TEMPORARY:
+ case RID_REMOVE_CV:
+ case RID_REMOVE_REFERENCE:
+ case RID_REMOVE_CVREF:
return true;
default:
break;