Skip to content

fix(templates): avoid reusing specialization without rescan info in C… - #390

Open
jakub-labenski wants to merge 1 commit into
edgcpp:mainfrom
jakub-labenski:fix/ctad-rescan-info-equivalence
Open

jakub-labenski wants to merge 1 commit into
edgcpp:mainfrom
jakub-labenski:fix/ctad-rescan-info-equivalence

Conversation

@jakub-labenski

@jakub-labenski jakub-labenski commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

…TAD []

Discussion #336

compare_expressions checked, under CC_EXACT_EQUIVALENCE, that both nodes either have or lack rescan info. That check only ran when the type comparison was done, and the type comparison is skipped for variable references.

As a result, a specialization such as P<b> (b a dependent static data member) created by a member declaration, with no rescan info, could be reused for the same specialization in a constructor parameter type. Then, building the implicit deduction guide for class template argument deduction failed with the internal error "missing default rescan info".

Move the rescan info check out of the type comparison block so it applies to all equivalent nodes.

Add regression test
regressions/ctad-dependent-member-template-arg-reuse.sft.cpp and a Changes entry.

Summary by CodeRabbit

  • Bug Fixes
    • Improved exact-equivalence checks so expression comparisons consistently account for rescan information, including when type comparison is skipped.
    • Fixed a compiler error affecting certain C++17 class template argument deduction cases involving dependent member-template arguments reused within a class. These cases can now be compiled without the previous internal error.

…TAD []

compare_expressions checked, under CC_EXACT_EQUIVALENCE, that both nodes
either have or lack rescan info.  That check only ran when the type
comparison was done, and the type comparison is skipped for variable
references.

As a result, a specialization such as P<b> (b a dependent static data
member) created by a member declaration, with no rescan info, could be
reused for the same specialization in a constructor parameter type.  Then,
building the implicit deduction guide for class template argument
deduction failed with the internal error "missing default rescan info".

Move the rescan info check out of the type comparison block so it applies
to all equivalent nodes.

Add regression test
regressions/ctad-dependent-member-template-arg-reuse.sft.cpp and a Changes
entry.
@coderabbitai

coderabbitai Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 76a7935f-9d57-4d8c-a010-b70d3c46b919
Commits

Reviewing files that changed from the base of the PR and between 35b7c47 and e560a91.

Files selected for processing: 4
  • src/il.c
  • src/pending_changes/ctad-missing-rescan-info.txt
  • tests/tests/regressions/.ctad-dependent-member-template-arg-reuse.rto/default.1.1.txt
  • tests/tests/regressions/ctad-dependent-member-template-arg-reuse.sft.cpp

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

Walkthrough

The exact-equivalence check for mismatched rescan information now also runs when type comparison is skipped. A C++17 regression test covers class template argument deduction with reused dependent member template arguments.

Changes: CTAD rescan-info handling

Layer / File(s) Summary
Equivalence check and CTAD regression
src/il.c, tests/tests/regressions/ctad-dependent-member-template-arg-reuse.sft.cpp, tests/tests/regressions/.ctad-dependent-member-template-arg-reuse.rto/default.1.1.txt, src/pending_changes/ctad-missing-rescan-info.txt
compare_expressions now checks mismatched rescan_info presence even when type comparison is skipped. The C++17 regression test exercises CTAD for two class templates, and the test invocation and change note describe the case.

Priority: Normal

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix · Severity of issue fixed: Low

Suggested reviewers: nv-cmeerw

Merge Risk: Minimal · up to e560a

The change addresses the reported CTAD failure, and no actionable merge-blocking risk is identified. It is ready for normal merge checks.

Pre-merge checks: Passed 4 · Inconclusive 1

Failed Failed checks: 1 inconclusive

Check name Status Explanation Resolution
Docstring Coverage Inconclusive Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 1 files. (3 skipped: 2 … Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly describes the main template-related fix: preventing reuse of a specialization without rescan information. It is specific and aligned with the implementation and regression test.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 1 files. (3 skipped: 2 unsupported, 1 too large.)

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

@edgcpp-bot

Copy link
Copy Markdown
Collaborator

AcknowlEDG review results updated for e560a91f4de1:

@edgcpp-bot

Copy link
Copy Markdown
Collaborator

AcknowlEDG review results updated for e560a91f4de1:

CI success.

@codecov

codecov Bot commented Oct 26, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

This branch has not been deployed

No deployments
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.

2 participants