shafik added a comment.

In D132918#3766909 <https://reviews.llvm.org/D132918#3766909>, @ilya-biryukov 
wrote:

> I was just passing by, but wanted to add more context from our investigation 
> with @kadircet.
> If variables with incomplete types appear inside non-template `constexpr` 
> function this gets detected by a call to `CheckConstexprFunctionDefinition` 
> inside `ActOnFinishFunctionBody`:
>
>   if (!IsInstantiation && FD && FD->isConstexpr() && !FD->isInvalidDecl() &&
>       !CheckConstexprFunctionDefinition(FD, CheckConstexprKind::Diagnose))
>     FD->setInvalidDecl();
>
> So the resulting `constexpr` function is marked as invalid and Clang does not 
> attempt to evaluate its body.
> However, `CheckConstexprFunctionDefinition` does not run for template 
> function instantiation, so the `VarDecl` marked invalid ends up inside a 
> valid `constexpr` function and Clang does run the evaluation.

This is helpful information but I am not sure this convinces me that 
`EvaluateVarDecl` is the correct place to check. Why not in `EvaluateDecl` or 
`EvaluateStmt`? Both locations we could also check.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D132918/new/

https://reviews.llvm.org/D132918

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to