[clang] Fix references to complete types in attribute references (PR #209537)
Erich Keane via cfe-commits
cfe-commits at lists.llvm.org
Wed Jul 15 06:28:33 PDT 2026
================
@@ -3212,8 +3212,17 @@ static bool HandleLValueMember(EvalInfo &Info, const Expr *E, LValue &LVal,
const FieldDecl *FD,
const ASTRecordLayout *RL = nullptr) {
if (!RL) {
- if (FD->getParent()->isInvalidDecl()) return false;
- RL = &Info.Ctx.getASTRecordLayout(FD->getParent());
+ const RecordDecl *RD = FD->getParent();
+ if (RD->isInvalidDecl())
+ return false;
+ // There are some cases where the base is not yet complete but we haven't
+ // disagnosed (such as in a template instantation of an attribute that
+ // references the expression, ala enable_if). These aren't necessarily
+ // constant expressions so we return 'false', but they might be, so we don't
+ // diagnose.
+ if (!RD->isCompleteDefinition())
+ return false;
----------------
erichkeane wrote:
@tbaederr for visibility.
I tried my test with `-fexperimental-new-constant-interpreter` and it doesn't reproduce, so I think that means no?
https://github.com/llvm/llvm-project/pull/209537
More information about the cfe-commits
mailing list