[PATCH] D82657: [AST][RecoveryAST] Preserve the type by default for recovery expression.
guopeilin via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Aug 19 23:23:56 PDT 2021
guopeilin added a comment.
Hi @hokein , I encounter a bug when clang parses enum and I have been recorded in https://bugs.llvm.org/show_bug.cgi?id=51554.
The source code like the following:
enum E { e = E() };
int main() {
return 0;
}
Some error message are expected like the following:
test.cpp:1:14: error: invalid use of incomplete type 'E'
enum E { e = E() };
^~~
test.cpp:1:6: note: definition of 'E' is not complete until the closing '}'
enum E { e = E() };
Also, I have made some analyses like the following:
In ParseDecl.cpp:
1. llvm-10:
AssignedVal.get(): NULL
2. llvm-12(Context.getLangOpts().RecoveryASTType: default false)(early-version):
AssignedVal.get(): RecoveryExpr 0xaaaaba19df20 '<dependent type>' contains-errors lvalue
3. llvm-12(Context.getLangOpts().RecoveryASTType: default true) (latest-version, Finally crashed):
AssignedVal.get()->dump(): RecoveryExpr 0xaaaabb4d9500 'enum E' contains-errors
In CheckEnumConstant(), EltTy(type: QualType, value: EnumType 0xaaaabb517dd0 'enum E') cannot use getIntWidth(), so crashed. But the code doesn't seem to be wrong around here.
Could you please have a look at this issue? Thanks a lot.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D82657/new/
https://reviews.llvm.org/D82657
More information about the cfe-commits
mailing list