[Bug c++/124368] [reflection] bogus errors with meta::extent
cvs-commit at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Wed Mar 4 23:38:52 GMT 2026
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=124368
--- Comment #1 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The trunk branch has been updated by Marek Polacek <mpolacek@gcc.gnu.org>:
https://gcc.gnu.org/g:8db7ba7ffbf83c624b572e45c9525ad5740b8f54
commit r16-7901-g8db7ba7ffbf83c624b572e45c9525ad5740b8f54
Author: Marek Polacek <polacek@redhat.com>
Date: Wed Mar 4 17:32:14 2026 -0500
c++/reflection: fix return value of meta::extent [PR124368]
std::meta::extent returns a size_t, but eval_extent returns either
size_zero_node or size_binop(), both of which are of type sizetype,
which is not the C/C++ size_t and so we don't pass the check in
cxx_eval_outermost_constant_expr:
/* Check we are not trying to return the wrong type. */
if (!same_type_ignoring_top_level_qualifiers_p (type, TREE_TYPE (r)))
We should convert to size_type_node which represents the C/C++ size_t,
like for instance fold_sizeof_expr does.
PR c++/124368
gcc/cp/ChangeLog:
* reflect.cc (eval_extent): Convert the result to size_type_node.
gcc/testsuite/ChangeLog:
* g++.dg/reflect/extent1.C: New test.
Reviewed-by: Jakub Jelinek <jakub@redhat.com>
More information about the Gcc-bugs
mailing list