-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Fix #12910 FP containerOutOfBounds with overloaded template function #7453
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
Conversation
lib/symboldatabase.cpp
Outdated
if (matches.size() == 1) | ||
if (matches.size() == 1 && std::none_of(functionList.begin(), functionList.end(), [tok](const Function& f) { | ||
const auto nTok = tok->str().size(); | ||
return startsWith(f.name(), tok->str()) && f.name().size() > nTok + 2 && f.name()[nTok + 1] == '<'; |
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.
return startsWith(f.name(), tok->str()) && f.name().size() > nTok + 2 && f.name()[nTok + 1] == '<'; | |
return startsWith(f.name(), tok->str() + "<") && f.name().size() > nTok + 2; |
I still feel it's hacky but this seems better.
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.
The function name seems to be func < arg >
instead of func<arg>
for some reason.
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.
yeah there is (sometimes?) space before the "<" . we did not used to have it. maybe the extra spaces are removed in the future again who knows.
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.
If you have examples for either case I will see if I can bisect this.
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.
If you have examples for either case I will see if I can bisect this.
The spaces appear in the output of --debug -v
(e.g. name:
), but I don't know what the significance is.
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.
template <class T> void fun()
{
}
int main()
{
fun<int>();
}
1.77
1:
|
4:
5: int main ( )
6: {
7: fun<int> ( ) ;
8: } void fun<int> ( )
2: {
3: }
[...]
Scope: 000001F7E6853E30 Function
className: fun<int>
[...]
##AST
( 'signed int'
`-main
( 'void'
`-fun<int>
( 'void'
`-fun<int>
1.78
1:
|
4:
5: int main ( )
6: {
7: fun < int > ( ) ;
8: } void fun < int > ( )
2: {
3: }
[...]
Scope: 000001CBB41650D0 Function
className: fun < int >
[...]
##AST
( 'signed int'
`-main
( 'void'
`-fun < int >
( 'void'
`-fun < int >
1.82
1:
|
4:
5: int main ( )
6: {
7: fun<int> ( ) ;
8: } void fun<int> ( )
2: {
3: }
[...]
Scope: 000001E34CC268D0 Function
className: fun < int >
[...]
##AST
( 'signed int'
`-main
( 'void'
`-fun < int >
( 'void'
`-fun < int >
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.
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.
Something in here we need to file a ticket about?
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.
The inconsistent use of spaces in template names, perhaps.
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.
I agree.. it feels like there could be cases that does not work as wanted. |
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.
well I can accept this. If the space is removed in the future we'll have to change this.
Feels hacky though.