================
@@ -3140,15 +3140,17 @@ static void checkNewAttributesAfterDef(Sema &S, Decl 
*New, const Decl *Old) {
         --E;
         continue;
       }
-    } else if (isa<SelectAnyAttr>(NewAttribute) &&
-               cast<VarDecl>(New)->isInline() &&
-               !cast<VarDecl>(New)->isInlineSpecified()) {
+    } else if (isa<SelectAnyAttr>(NewAttribute)) {
       // Don't warn about applying selectany to implicitly inline variables.
       // Older compilers and language modes would require the use of selectany
       // to make such variables inline, and it would have no effect if we
       // honored it.
-      ++I;
-      continue;
+      if (auto *VD = dyn_cast<VarDecl>(New)) {
+        if (VD->isInline() && !VD->isInlineSpecified()) {
+          ++I;
+          continue;
+        }
+      }
----------------
AaronBallman wrote:

```suggestion
      if (const auto *VD = dyn_cast<VarDecl>(New); VD && VD->isInline() && 
!VD->isInlineSpecified()) {
        ++I;
        continue;
      }
```
Needs to be reformatted though.

https://github.com/llvm/llvm-project/pull/189641
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to