aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/constraint.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/constraint.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/constraint.cc')
-rw-r--r--gcc/cp/constraint.cc3
1 files changed, 3 insertions, 0 deletions
diff --git a/gcc/cp/constraint.cc b/gcc/cp/constraint.cc
index 266ec58..ca73aff 100644
--- a/gcc/cp/constraint.cc
+++ b/gcc/cp/constraint.cc
@@ -3714,6 +3714,9 @@ diagnose_trait_expr (tree expr, tree args)
case CPTK_BASES:
case CPTK_DIRECT_BASES:
case CPTK_UNDERLYING_TYPE:
+ case CPTK_REMOVE_CV:
+ case CPTK_REMOVE_REFERENCE:
+ case CPTK_REMOVE_CVREF:
/* We shouldn't see these non-expression traits. */
gcc_unreachable ();
/* We deliberately omit the default case so that when adding a new