Skip to content

Initial support for C++26 enumerating expansion statements (IL CHANGE) [GH #216] - #477

Merged
daveedvdv-nvidia merged 1 commit into
mainfrom
fix/216
Nov 18, 2026
Merged

daveedvdv-nvidia merged 1 commit into
mainfrom
fix/216

Conversation

@nv-cmeerw

@nv-cmeerw nv-cmeerw commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

Only has support for enumerating expansion statements for now. Also doesn't support substitution into requires-expressions yet. Added the upstream constexpr changes.

The front end now supports enumerating expansion statements in C++26 mode. For
example, with --c++26:

  constexpr int f() {
    int n = 0;
    template for (auto i : {1, 2, 3}) {
      n += i;
    }
    return n;
  }
  static_assert(f() == 6);

Expansion statements are also accepted with a warning in GNU C++ modes
emulating GCC 16 or later. Iterating and destructuring expansion statements
are not yet implemented.

Summary by CodeRabbit

  • New Features
    • Added initial support for C++26 enumerating expansion statements (template for), including compile-time expansion and per-element processing. Iterating and destructuring expansion forms are not yet supported.
    • Enabled expansion statements as a GNU-mode extension in C++11-and-later modes, with a warning when used before C++26.
  • Bug Fixes
    • Improved expansion-statement diagnostics and source-location notes.
    • Corrected handling of initializer lifetimes, control flow, lambda captures, structured bindings, and template-dependent expansion cases.

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants