diff options
author | Patrick Palka <ppalka@redhat.com> | 2022-06-03 14:58:22 -0400 |
---|---|---|
committer | Patrick Palka <ppalka@redhat.com> | 2022-06-03 14:58:22 -0400 |
commit | 0ecb6b906f215ec56df1a555139abe9ad95414fb (patch) | |
tree | fd733587efa6ed05bdb98f9127ba76a216883535 /gcc/expr.cc | |
parent | 284ae8b46f5eef74c0b660a87a7169497f559e73 (diff) | |
download | gcc-0ecb6b906f215ec56df1a555139abe9ad95414fb.zip gcc-0ecb6b906f215ec56df1a555139abe9ad95414fb.tar.gz gcc-0ecb6b906f215ec56df1a555139abe9ad95414fb.tar.bz2 |
c++: value-dep but not type-dep decltype expr [PR105756]
Here during ahead of time instantiation of the value-dependent but not
type-dependent decltype expression (5 % N) == 0, cp_build_binary_op folds
the operands of the == via cp_fully_fold, which performs speculative
constexpr evaluation, and from which we crash for (5 % N) due to the
value-dependence.
Since the operand folding performed by cp_build_binary_op appears to
be solely for sake of diagnosing overflow, and since these diagnostics
are suppressed when in an unevaluated context, this patch avoids this
crash by suppressing cp_build_binary_op's operand folding accordingly.
PR c++/105756
gcc/cp/ChangeLog:
* typeck.cc (cp_build_binary_op): Don't fold operands
when c_inhibit_evaluation_warnings.
gcc/testsuite/ChangeLog:
* g++.dg/cpp0x/decltype82.C: New test.
Diffstat (limited to 'gcc/expr.cc')
0 files changed, 0 insertions, 0 deletions