[clang] Don't wrap immediate invocations in ConstantExprs within constexpr initializers (PR #89565)

via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 22 04:08:57 PDT 2024


================
@@ -2554,16 +2554,26 @@ Decl *Parser::ParseDeclarationAfterDeclarator(
   return ParseDeclarationAfterDeclaratorAndAttributes(D, TemplateInfo);
 }
 
+static bool isConstexprVariable(const Decl *D) {
+  if (const VarDecl *Var = dyn_cast_or_null<VarDecl>(D))
----------------
cor3ntin wrote:

```suggestion
  if (const VarDecl *Var = dyn_cast<VarDecl>(D))
```
`D` can never be null here, right?
Beside I think the recommended practice would be to use `if_present` rather than `or_null`, the later being deprecated

https://github.com/llvm/llvm-project/pull/89565


More information about the cfe-commits mailing list