File tree 2 files changed +22
-2
lines changed
2 files changed +22
-2
lines changed Original file line number Diff line number Diff line change @@ -354,8 +354,13 @@ SVal ExprEngine::computeObjectUnderConstruction(
354
354
// Operator arguments do not correspond to operator parameters
355
355
// because this-argument is implemented as a normal argument in
356
356
// operator call expressions but not in operator declarations.
357
- const TypedValueRegion *TVR = Caller->getParameterLocation (
358
- *Caller->getAdjustedParameterIndex (Idx), BldrCtx->blockCount ());
357
+ std::optional<unsigned int > Index =
358
+ Caller->getAdjustedParameterIndex (Idx);
359
+ if (!Index) {
360
+ return std::nullopt;
361
+ }
362
+ const TypedValueRegion *TVR =
363
+ Caller->getParameterLocation (*Index, BldrCtx->blockCount ());
359
364
if (!TVR)
360
365
return std::nullopt;
361
366
Original file line number Diff line number Diff line change
1
+ // RUN: %clang_analyze_cc1 -analyzer-checker=core.DivideZero -std=c++23 -verify %s
2
+ // expected-no-diagnostics
3
+
4
+ struct S
5
+ {
6
+ constexpr auto operator ==(this auto , S)
7
+ {
8
+ return true ;
9
+ }
10
+ };
11
+
12
+ int main ()
13
+ {
14
+ return S {} == S {};
15
+ }
You can’t perform that action at this time.
0 commit comments