Fix #14684: FP unreadVariable with auto and brace-init#8508
Fix #14684: FP unreadVariable with auto and brace-init#8508ludviggunne wants to merge 2 commits intocppcheck-opensource:mainfrom
Conversation
| if (!parent->astOperand1()) | ||
| return; | ||
|
|
||
| if (Token::Match(parent->astOperand1()->previous(), "auto %var% {")) { |
There was a problem hiding this comment.
There could be variations like auto&& or auto const&.
Is the ValueType set correctly for e.g. T t{ 1 }?
There was a problem hiding this comment.
Is the T from a template? I would assume it would be set to whatever it is in the instantiation, but i can double check.
There was a problem hiding this comment.
Is the
Tfrom a template? I would assume it would be set to whatever it is in the instantiation, but i can double check.
I was thinking about e.g. struct T { int i; };. If that works, we might find a way to make auto work as well.
There was a problem hiding this comment.
I was thinking about e.g. struct T { int i; };. If that works, we might find a way to make auto work as well.
I don't follow really. That is a struct declaration. Shouldn't it be some variable declaration that would be related here?
There was a problem hiding this comment.
I was thinking about e.g. struct T { int i; };. If that works, we might find a way to make auto work as well.
I don't follow really. That is a struct declaration. Shouldn't it be some variable declaration that would be related here?
That was just my explanation what T in T t{1}; is supposed to be.
No description provided.