mirror of
https://github.com/gcc-mirror/gcc.git
synced 2026-05-06 23:14:49 +02:00
This patch attempts to implement this paper, adds a new trait, builtin trait and metafunction. 2026-04-03 Jakub Jelinek <jakub@redhat.com> gcc/cp/ * cp-trait.def (__builtin_is_structural): New trait. * semantics.cc (trait_expr_value): Handle CPTK_IS_STRUCTURAL. (finish_trait_expr): Likewise. * constraint.cc (diagnose_trait_expr): Likewise. * metafns.gperf (enum metafn_code): Add METAFN_IS_STRUCTURAL_TYPE. (is_structural_type): New metafn. * metafns.h: Regenerate. * reflect.cc (eval_is_structural_type): New function. (process_metafunction): Handle METAFN_IS_STRUCTURAL_TYPE. gcc/testsuite/ * g++.dg/reflect/type_trait14.C: New test. * g++.dg/reflect/eh1.C: Add test for is_structural_type. * g++.dg/reflect/eh2.C: Likewise. libstdc++-v3/ * include/bits/version.def (is_structural): New. * include/bits/version.h: Regenerate. * include/std/type_traits (__glibcxx_want_is_structural): Define. (std::is_structural): New type trait. (std::is_structural_v): New type trait variable template. * include/std/meta (std::meta::is_structural_type): New declaration. * src/c++23/std.cc.in: Export std::is_structural, std::is_structural_v and std::meta::is_structural_type. * testsuite/20_util/is_structural/requirements/explicit_instantiation.cc: New test. * testsuite/20_util/is_structural/requirements/typedefs.cc: New test. * testsuite/20_util/is_structural/value.cc: New test. * testsuite/20_util/variable_templates_for_traits.cc: Test is_structural_v. Reviewed-by: Jason Merrill <jason@redhat.com> Reviewed-by: Jonathan Wakely <jwakely@redhat.com>