Skip to content

Conversation

@masatake
Copy link
Member

Fixes #4344
Derived from #4348.

Fix assertion failure in cxxScopePushTop when parsing member function pointer template specializations. The debug assertion requiring tokens to be simple identifiers was too strict for complex template constructs like "TestUtil<MEMTYPE CLASS::*>::isNull".

The original code searched :: and pushed the following token to the scope stack. In "TestUtil<MEMTYPE CLASS::>::isNull", "" was pushed as the next token. However, "*" is no an identifier.

The new code skips template arguments. So "*" is never pushed.

@masatake masatake requested a review from Copilot November 23, 2025 18:24
@codecov
Copy link

codecov bot commented Nov 23, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 85.88%. Comparing base (d48558f) to head (e281716).
⚠️ Report is 11 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #4354   +/-   ##
=======================================
  Coverage   85.87%   85.88%           
=======================================
  Files         252      252           
  Lines       62597    62655   +58     
=======================================
+ Hits        53755    53811   +56     
- Misses       8842     8844    +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copilot finished reviewing on behalf of masatake November 23, 2025 18:35
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes an assertion failure in the C++ parser when handling template specializations with complex member function pointer types. The issue occurred when parsing constructs like TestUtil<MEMTYPE CLASS::*>::isNull, where the scope parsing logic incorrectly attempted to push non-identifier tokens (like *) onto the scope stack.

  • Modified scope parsing to skip template arguments when resolving scope names
  • Added comprehensive test cases for template specializations with nested types and member function pointers
  • Improved error handling for unbalanced template brackets

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
parsers/cxx/cxx_parser_function.c Enhanced scope parsing logic to skip template arguments when searching for :: scope separators, preventing invalid tokens from being pushed to the scope stack
Units/parser-cxx.r/template-specializations-including-op.d/validator Test configuration requiring C++11 support for template specialization test
Units/parser-cxx.r/template-specializations-including-op.d/input.cpp Test input covering template specializations with simple types, nested namespaces, and nested templates
Units/parser-cxx.r/template-specializations-including-op.d/expected.tags Expected tag output verifying correct scope attribution for specialized template functions
Units/parser-cxx.r/template-specializations-including-op.d/args.ctags Test configuration to disable sorting for deterministic output
Units/parser-cxx.r/template-member-function-pointer-scope.d/validator Test configuration requiring C++11 support for member function pointer test
Units/parser-cxx.r/template-member-function-pointer-scope.d/input.cpp Test input for complex member function pointer template specializations that previously caused crashes
Units/parser-cxx.r/template-member-function-pointer-scope.d/expected.tags Expected tag output for member function pointer templates
Units/parser-cxx.r/template-member-function-pointer-scope.d/args.ctags Test configuration with signature fields and specific tag kinds enabled

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@masatake masatake force-pushed the c++--scope-op-in-specialization branch from 5980db8 to a1a5bbf Compare November 23, 2025 18:41
@masatake masatake requested a review from Copilot November 23, 2025 18:44
Copilot finished reviewing on behalf of masatake November 23, 2025 18:52
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Fixes universal-ctags#4344
Derived from universal-ctags#4348.

Fix assertion failure in cxxScopePushTop when parsing member function
pointer template specializations. The debug assertion requiring tokens to
be simple identifiers was too strict for complex template constructs like
"TestUtil<MEMTYPE CLASS::*>::isNull".

The original code searched :: and pushed the following token to the
scope stack. In "TestUtil<MEMTYPE CLASS::*>::isNull", "*" was pushed
as the next token. However, "*" is no an identifier.

The new code skips template arguments. So "*" is never pushed.

Co-Authored-By: Bernát Gábor <[email protected]>
Signed-off-by: Masatake YAMATO <[email protected]>
@masatake masatake force-pushed the c++--scope-op-in-specialization branch from a1a5bbf to e281716 Compare November 23, 2025 19:08
@masatake masatake requested a review from Copilot November 23, 2025 19:08
Copilot finished reviewing on behalf of masatake November 23, 2025 19:21
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 9 out of 9 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@masatake masatake requested a review from Copilot November 23, 2025 19:27
Copilot finished reviewing on behalf of masatake November 23, 2025 19:29
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 9 out of 9 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@masatake masatake requested a review from Copilot November 23, 2025 20:11
Copilot finished reviewing on behalf of masatake November 23, 2025 20:13
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 9 out of 9 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@masatake masatake requested a review from Copilot November 23, 2025 21:16
Copilot finished reviewing on behalf of masatake November 23, 2025 21:19
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 9 out of 9 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@masatake masatake merged commit a0b321f into universal-ctags:master Nov 26, 2025
119 of 120 checks passed
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.

C++ Scope Management Assertion Failure

1 participant