-
Notifications
You must be signed in to change notification settings - Fork 640
C++: skip template arguments in template specializations #4354
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
C++: skip template arguments in template specializations #4354
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 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. 🚀 New features to boost your workflow:
|
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.
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.
Units/parser-cxx.r/template-member-function-pointer-scope.d/input.cpp
Outdated
Show resolved
Hide resolved
5980db8 to
a1a5bbf
Compare
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.
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]>
a1a5bbf to
e281716
Compare
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.
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.
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.
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.
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.
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.
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.
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.
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.