File tree Expand file tree Collapse file tree 3 files changed +9
-1
lines changed Expand file tree Collapse file tree 3 files changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -71,7 +71,9 @@ void OptionalValueConversionCheck::registerMatchers(MatchFinder *Finder) {
71
71
ofClass (matchers::matchesAnyListedName (OptionalTypes)))),
72
72
hasType (ConstructTypeMatcher),
73
73
hasArgument (0U , ignoringImpCasts (anyOf (OptionalDereferenceMatcher,
74
- StdMoveCallMatcher))))
74
+ StdMoveCallMatcher))),
75
+ unless (anyOf (hasAncestor (typeLoc ()),
76
+ hasAncestor (expr (matchers::hasUnevaluatedContext ())))))
75
77
.bind (" expr" ),
76
78
this );
77
79
}
Original file line number Diff line number Diff line change @@ -204,6 +204,10 @@ Changes in existing checks
204
204
eliminating false positives resulting from direct usage of bitwise operators
205
205
within parentheses.
206
206
207
+ - Improved :doc: `bugprone-optional-value-conversion
208
+ <clang-tidy/checks/bugprone/optional-value-conversion>` check by eliminating
209
+ false positives resulting from use of optionals in unevaluated context.
210
+
207
211
- Improved :doc: `bugprone-suspicious-include
208
212
<clang-tidy/checks/bugprone/suspicious-include>` check by replacing the local
209
213
options `HeaderFileExtensions ` and `ImplementationFileExtensions ` by the
Original file line number Diff line number Diff line change @@ -210,4 +210,6 @@ void correct(std::optional<int> param)
210
210
std::optional<long >* p2 = &p;
211
211
takeOptionalValue (p2->value_or (5U ));
212
212
takeOptionalRef (p2->value_or (5U ));
213
+
214
+ using Type = decltype (takeOptionalValue (*param));
213
215
}
You can’t perform that action at this time.
0 commit comments