aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/constraint.cc
diff options
context:
space:
mode:
authorKen Matsui <kmatsui@gcc.gnu.org>2023-12-06 21:33:05 -0800
committerJason Merrill <jason@redhat.com>2023-12-10 13:11:23 -0500
commitbd3776c03b00e6106d3609eb6cfcc99c0320b0c7 (patch)
tree3933a6fd9d04561c5df8e6c0c194d377a92428c9 /gcc/cp/constraint.cc
parent8769777bf74a844b05521bf51bed4db4c9ca66d4 (diff)
downloadgcc-bd3776c03b00e6106d3609eb6cfcc99c0320b0c7.zip
gcc-bd3776c03b00e6106d3609eb6cfcc99c0320b0c7.tar.gz
gcc-bd3776c03b00e6106d3609eb6cfcc99c0320b0c7.tar.bz2
c++: Implement __is_member_pointer built-in trait
This patch implements built-in trait for std::is_member_pointer. gcc/cp/ChangeLog: * cp-trait.def: Define __is_member_pointer. * constraint.cc (diagnose_trait_expr): Handle CPTK_IS_MEMBER_POINTER. * semantics.cc (trait_expr_value): Likewise. (finish_trait_expr): Likewise. gcc/testsuite/ChangeLog: * g++.dg/ext/has-builtin-1.C: Test existence of __is_member_pointer. * g++.dg/ext/is_member_pointer.C: New test. Signed-off-by: Ken Matsui <kmatsui@gcc.gnu.org>
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 062dc40..fb150e0 100644
--- a/gcc/cp/constraint.cc
+++ b/gcc/cp/constraint.cc
@@ -3758,6 +3758,9 @@ diagnose_trait_expr (tree expr, tree args)
case CPTK_IS_LITERAL_TYPE:
inform (loc, " %qT is not a literal type", t1);
break;
+ case CPTK_IS_MEMBER_POINTER:
+ inform (loc, " %qT is not a member pointer", t1);
+ break;
case CPTK_IS_NOTHROW_ASSIGNABLE:
inform (loc, " %qT is not nothrow assignable from %qT", t1, t2);
break;