File tree Expand file tree Collapse file tree 2 files changed +22
-2
lines changed Expand file tree Collapse file tree 2 files changed +22
-2
lines changed Original file line number Diff line number Diff line change @@ -354,8 +354,13 @@ SVal ExprEngine::computeObjectUnderConstruction(
354354        //  Operator arguments do not correspond to operator parameters
355355        //  because this-argument is implemented as a normal argument in
356356        //  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 ());
359364        if  (!TVR)
360365          return  std::nullopt ;
361366
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