diff options
author | Jakub Jelinek <jakub@redhat.com> | 2025-08-15 22:38:41 +0200 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2025-08-15 22:38:41 +0200 |
commit | 9a8b436b005b56e5ec3d8274284ae3afb4e7ba72 (patch) | |
tree | b0084c6b0fe6ece925ff51dad7480a81011a091e /libjava/classpath/resource | |
parent | 91b5fc4ae2e5c8693cc0b619562f15f90c0fdfaa (diff) | |
download | gcc-master.zip gcc-master.tar.gz gcc-master.tar.bz2 |
clang++ apparently added a SFINAE-friendly __builtin_structured_binding_size
trait to return the structured binding size (or error if not in SFINAE
contexts if a type doesn't have a structured binding size).
The expansion statement patch already anticipated this through adding
complain argument to cp_finish_decomp.
The following patch implements it.
2025-08-15 Jakub Jelinek <jakub@redhat.com>
gcc/
* doc/extend.texi (Type Traits): Document
__builtin_structured_binding_size.
gcc/cp/
* cp-trait.def (STRUCTURED_BINDING_SIZE): New unary trait.
* cp-tree.h (finish_structured_binding_size): Declare.
* semantics.cc (trait_expr_value): Handle
CPTK_STRUCTURED_BINDING_SIZE.
(finish_structured_binding_size): New function.
(finish_trait_expr): Handle CPTK_RANK and CPTK_TYPE_ORDER
in the switch instead of just doing break; for those and
ifs at the end to handle them. Handle CPTK_STRUCTURED_BINDING_SIZE.
* pt.cc (tsubst_expr): Likewise.
* constraint.cc (diagnose_trait_expr): Likewise.
* decl.cc (get_tuple_size): Use mce_true for maybe_const_value.
(cp_decomp_size): Diagnose incomplete types not just if
processing_template_decl, and use error_at instead of pedwarn.
If btype is NULL, just return 0 instead of diagnosing an error.
gcc/testsuite/
* g++.dg/cpp26/expansion-stmt15.C: Expect different diagnostics
for zero size destructuring expansion statement.
* g++.dg/ext/builtin-structured-binding-size1.C: New test.
* g++.dg/ext/builtin-structured-binding-size2.C: New test.
* g++.dg/ext/builtin-structured-binding-size3.C: New test.
* g++.dg/ext/builtin-structured-binding-size4.C: New test.
Diffstat (limited to 'libjava/classpath/resource')
0 files changed, 0 insertions, 0 deletions