ilya-biryukov added a comment. 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. 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