On 12/22/25 11:46 PM, Yuao Ma wrote:
On Mon, Dec 22, 2025 at 12:02 PM Jason Merrill <[email protected]> wrote:

On 12/21/25 2:02 PM, Yuao Ma wrote:
Hello world,

This patch fixes an ICE encountered when using implicit constexpr. The
issue can be reproduced here:
https://compiler-explorer.com/z/39MsxKxTT. I have further reduced this
example to the test case included in the patch.

I bisected the regression to commit r15-3631-g4ee692337c4ec1.

Please also file a bug if there isn't one already.


Filed https://gcc.gnu.org/bugzilla/show_bug.cgi?id=123261.

The root cause of the crash is that the function body is discarded to
void_cst when using implicit constexpr. We need to preserve the
function body to prevent this ICE during diagnostics.

Regression tested on aarch64-linux. Ok for trunk?

Thanks,
Yuao

+      if (!DECL_DECLARED_CONSTEXPR_P (fn) && !flag_implicit_constexpr

How about using maybe_constexpr_fn?


Looks like it also works! Updated patch accordingly.

OK, thanks.

Jason

Reply via email to