Landing: 0e74517b70d0

Project / Subsystem

gcc / c++

Date

2026-08-14

Author

Patrick Palka

Commit

0e74517b70d06105bd40c8caa6dc192b4af3ccff

Source

github

Perf win

No

Breaking

No

All attributes

project
gcc
subsystem
c++
patch_id
—
commit_hash
0e74517b70d06105bd40c8caa6dc192b4af3ccff
source_type
github
headline
Fix ICE with maybe_warn_nodiscard on non-dependent calls.
tldr
C++ compiler avoids ICE when `maybe_warn_nodiscard` encounters non-dependent calls.
author
Patrick Palka
outcome
committed
performance_win
false
breaking_change
false
series_id
—
series_parts
[]
tags
  • • c++
  • • template
  • • ICE
  • • bugfix
discussion_id_link
—
bugzilla_pr
—
date
2026-08-14T00:00:00.000Z

This commit resolves an Internal Compiler Error (ICE) that occurred when the maybe_warn_nodiscard function was invoked on non-dependent calls. The issue arose because cp_get_fndecl_from_callee attempted to fold templated callees using constant evaluation, which expects non-templated trees. The fix replaces maybe_constant_init with fold_non_dependent_expr to correctly instantiate templated trees before folding, thus preventing the ICE.