New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
crash on invalid after "error: 'foo' cannot be defined in a type alias template" #75221
Comments
@llvm/issue-subscribers-clang-frontend Author: None (wheatman)
The following invalid code crashes on the current post 17 trunk(2e19760)
https://godbolt.org/z/e7GqqKEKf
It triggers the following assert
The full dump is
|
The AST for the struct
The CXXRecordDecl is ill-formed: it is a valid decl, and it has a |
Looks like this regressed after clang-12: https://godbolt.org/z/x17zaM7oM It looks like if it is too late in |
I think we need to mark it invalid here: llvm-project/clang/lib/Parse/ParseDecl.cpp Line 4386 in 41d19fb
but we would need to add Then we could do something like this: if (DSContext == DeclSpecContext::DSC_alias_template_declaration) {
isInvalid = true;
PrevSpec = Tok.getIdentifierInfo()->getNameStart();
DiagID = diag::err_type_defined_in_alias_template;
break;
} which works but breaks two tests b/c of additional diagnostics. Additional work may be needed to get this into shape. |
…culating record layout (#87173) Try to fix #75221 This crash caused by calculating record layout which contains a field declaration with dependent type. Make it invalid before it is a complete definition to prevent this crash. Define a new scope type to record this type alias and set the record declaration invalid when it is defined in a type alias template. Co-authored-by: huqizhi <836744285@qq.com>
The following invalid code crashes on the current post 17 trunk(2e19760)
https://godbolt.org/z/e7GqqKEKf
It triggers the following assert
The full dump is
The text was updated successfully, but these errors were encountered: