GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Empty enclosing packs in generic lambdas [GH #500] by nv-cmeerw · Pull Request #528 · edgcpp/compiler

Conversation

@nv-cmeerw

@nv-cmeerw nv-cmeerw commented Nov 12, 2026 •
edited by coderabbitai Bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Fixes #500

A pack expansion in a generic lambda nested in a template instantiation could
produce an error node in the IL when it referenced a lambda parameter pack
before an empty enclosing parameter pack. Empty enclosing packs are now
handled correctly regardless of the order of the pack references. Spurious
warnings from prototype instantiations in such cases are also suppressed. For
example, with --c++20 -tused:

  template<int... Is> void f() {
    []<int... Js>() { ((Js * Is) * ... * 1); };
  }
  template void f<>();  // Previously produced an error node in the IL.

Summary by CodeRabbit

  • Bug Fixes
    • Corrected C++20 pack expansion handling in generic lambdas when an enclosing parameter pack is empty, including when pack references appear in different orders.
    • Suppressed spurious warnings during prototype instantiations while preserving relevant warnings during real instantiations.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@nv-cmeerw
nv-cmeerw requested a review from a team November 12, 2026 16:02
@coderabbitai

coderabbitai Bot commented Nov 12, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The compiler now sets generic-lambda pack expansion length to zero when the current pack is empty in a real instantiation. It also suppresses a warning in the related instantiation case. Regression tests cover pack combinations, warning output, and updated diagnostics.

Changes: Empty pack handling

Layer / File(s) Summary
Expansion length and warning handling
src/scope_stk.c, src/scope_stk.h, src/expr.c
The compiler sets expansion length to zero when the current pack is empty in a generic-lambda real instantiation. It exposes the instantiation check and uses it to suppress a warning in the specified case.
Regression coverage
tests/tests/regressions/gh-500*.sft.cpp, tests/tests/regressions/.gh-500*.rto/*, tests/tests/imported/clang/cpp/SemaCXX/.lambda-pack-expansion.rto/*, tests/tests/imported/gnu/cpp/cpp1z/*.rto/*, src/pending_changes/gh-500.txt
Regression tests cover empty and nonempty pack combinations and warning output. Imported Clang expected output removes two errors in each updated result. Imported GNU expected output updates instantiation traces. The pending-changes note describes the GH #500 case.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Bug fix · Severity of issue fixed: Low

Possibly related PRs

  • edgcpp/compiler#492: Suppresses missing-parameter-pack diagnostics for nested generic-lambda pack expansions and updates expected output for overlapping pack-expansion cases.

Suggested labels: bug

Suggested reviewers: daveedvdv-nvidia

Merge Risk: Minimal · up to c5dc4

The change fixes an error node in the IL for generic lambda pack expansions that reference an empty enclosing pack, and it adds regression tests. No concrete merge-blocking risk was identified.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title "Empty enclosing packs in generic lambdas [GH #500]" matches the main change. The raw summary and objectives describe a fix for an error node in the IL when a generic lambda's pack expansion…
Linked Issues check Passed Requirement [#500]: a pack expansion in a generic lambda nested in a real instantiation must not produce an enk_error node or tk_error type when an empty enclosing pack is referenced before a lambda p…
Out of Scope Changes check Passed Changes map to #500: the src/scope_stk.c fix (empty-pack handling in hybrid pack expansion), the linkage change that exposes in_generic_lambda_in_real_instantiation() and its src/scope_stk.h declarati…
Full details: Title check

Explanation

The title "Empty enclosing packs in generic lambdas [GH #500]" matches the main change. The raw summary and objectives describe a fix for an error node in the IL when a generic lambda's pack expansion references an empty enclosing parameter pack, and the title names that same subject. It is specific and concise, and it names the linked issue. No search was needed for this check.

Full details: Linked Issues check

Explanation

Requirement [#500]: a pack expansion in a generic lambda nested in a real instantiation must not produce an enk_error node or tk_error type when an empty enclosing pack is referenced before a lambda pack. The whole-PR diff of src/scope_stk.c (merge base to head) adds, in the hybrid-expansion branch, a rule that sets elements = 0 when elements_for_pack == 0. This applies regardless of which pack is encountered first, which matches the reproducer ((Seq * Vals) * ... * 1 with Vals = <>). The whole-PR diff of src/expr.c adds a suppression of the 'expression has no effect' warning when in_generic_lambda_in_real_instantiation() is true. Regression tests under tests/tests/regressions/ (gh-500.sft.cpp, gh-500.rto, gh-500-warnings.sft.cpp) cover the empty-pack case. The incremental diff from the previous reviewed head (cfe283b) to the current head (c5dc46e) could not be read, so changes made in that increment are not verified. The whole-PR diffs of the two source files match the previous assessment. Limits: I did not read the .rto expected-output files directly; the result relies on the summary for them.

Full details: Out of Scope Changes check

Explanation

Changes map to #500: the src/scope_stk.c fix (empty-pack handling in hybrid pack expansion), the linkage change that exposes in_generic_lambda_in_real_instantiation() and its src/scope_stk.h declaration (needed by src/expr.c), the src/expr.c warning suppression for generic lambdas in real instantiations (same code path as the reproducer), the pending-changes note for #500, and the gh-500 regression tests. The imported clang .lambda-pack-expansion.rto expectations drop two GH112352::S::foldExpr2 template-template-parameter errors. These are expected-output side effects of the same pack-expansion code path, not a demonstrated unrelated change. A reviewer should still confirm that removing these diagnostics is correct and does not hide a real error. The incremental diff since the previous reviewed head could not be read, so its content is not verified. No change is shown to be unrelated to #500.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

  • X
  • Mastodon
  • Reddit
  • LinkedIn
Recent review info

Run configuration

  • Source mode: Auto
  • Repository: edgcpp/compiler
  • Branch: main
  • File: .coderabbit.yaml
  • Commit: 63d8840
  • Layers: Repository YAML
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: d748db38-bf22-41c5-bd7e-7c49b30b2c4d
Commits

Reviewing files that changed from the base of the PR and between cfe283b and c5dc46e.

Files selected for processing: 19

  • src/expr.c
  • src/pending_changes/gh-500.txt
  • src/scope_stk.c
  • src/scope_stk.h
  • tests/tests/imported/clang/cpp/SemaCXX/.lambda-pack-expansion.rto/default.1.1.txt
  • tests/tests/imported/clang/cpp/SemaCXX/.lambda-pack-expansion.rto/edg_x86_32_cp.1.1.txt
  • tests/tests/imported/clang/cpp/SemaCXX/.lambda-pack-expansion.rto/edg_x86_64_cp.1.1.txt
  • tests/tests/imported/gnu/cpp/cpp1z/.constexpr-if-lambda5.rto/default.1.1.txt
  • tests/tests/imported/gnu/cpp/cpp1z/.fold-lambda4.rto/default.1.1.txt
  • tests/tests/regressions/.gh-500-warnings.rto/default.1.1.txt
  • tests/tests/regressions/.gh-500-warnings.rto/default.2.1.txt
  • tests/tests/regressions/.gh-500-warnings.rto/default.3.1.txt
  • tests/tests/regressions/.gh-500-warnings.rto/default.4.1.txt
  • tests/tests/regressions/.gh-500.rto/default.1.1.txt
  • tests/tests/regressions/.gh-500.rto/default.2.1.txt
  • tests/tests/regressions/.gh-500.rto/default.3.1.txt
  • tests/tests/regressions/.gh-500.rto/default.4.1.txt
  • tests/tests/regressions/gh-500-warnings.sft.cpp
  • tests/tests/regressions/gh-500.sft.cpp
Files skipped from review as they are similar to previous changes: 1

  • src/pending_changes/Spurious error nodes in IL for empty pack expansions #500.txt

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@edgcpp-bot

edgcpp-bot commented Nov 12, 2026

Copy link
Copy Markdown
Collaborator

AcknowlEDG review results updated for cfe283b811fe:

  • Test - Changes (new)
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@nv-cmeerw
Empty enclosing packs in generic lambdas [GH #500]
c5dc46e
@nv-cmeerw
nv-cmeerw force-pushed the fix/500 branch from cfe283b to c5dc46e Compare November 12, 2026 18:08
@edgcpp-bot

edgcpp-bot commented Nov 12, 2026

Copy link
Copy Markdown
Collaborator

AcknowlEDG review results updated for c5dc46e037e9:

  • Bench - C (new)
  • Bench - C++ (new)
  • Test - Changes (updated)

CI success.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

daveedvdv-nvidia
daveedvdv-nvidia approved these changes Nov 12, 2026
View reviewed changes

@daveedvdv-nvidia daveedvdv-nvidia left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@daveedvdv-nvidia
daveedvdv-nvidia added this pull request to the merge queue Nov 12, 2026
Merged via the queue into main with commit 95f0570 Nov 12, 2026
23 checks passed

Uh oh!

There was an error while loading. Please reload this page.

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

Reviewers

@daveedvdv-nvidia daveedvdv-nvidia daveedvdv-nvidia approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Spurious error nodes in IL for empty pack expansions

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@nv-cmeerw @edgcpp-bot @daveedvdv-nvidia
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.