diff options
author | Simon Martin <simon@nasilyan.com> | 2025-01-16 16:27:06 +0100 |
---|---|---|
committer | Simon Martin <simon@nasilyan.com> | 2025-01-16 21:06:24 +0100 |
commit | 37f38b0f97374476a4818b68c8df991886428787 (patch) | |
tree | 3a6669c6a6089a4097f529650918fa2ab06e46eb /libphobos/src/std | |
parent | 99bcce0d89b8a9aa9a1cc481b41be101c07d8bdf (diff) | |
download | gcc-37f38b0f97374476a4818b68c8df991886428787.zip gcc-37f38b0f97374476a4818b68c8df991886428787.tar.gz gcc-37f38b0f97374476a4818b68c8df991886428787.tar.bz2 |
c++: Make sure fold_sizeof_expr returns the correct type [PR117775]
We currently ICE upon the following code, that is valid under
-Wno-pointer-arith:
=== cut here ===
int main() {
decltype( [](auto) { return sizeof(void); } ) x;
return x.operator()(0);
}
=== cut here ===
The problem is that "fold_sizeof_expr (sizeof(void))" returns
size_one_node, that has a different TREE_TYPE from that of the sizeof
expression, which later triggers an assert in cxx_eval_store_expression.
This patch makes sure that fold_sizeof_expr always returns a tree with
the size_type_node type.
PR c++/117775
gcc/cp/ChangeLog:
* decl.cc (fold_sizeof_expr): Make sure the folded result has
type size_type_node.
gcc/testsuite/ChangeLog:
* g++.dg/cpp2a/constexpr-117775.C: New test.
Diffstat (limited to 'libphobos/src/std')
0 files changed, 0 insertions, 0 deletions