[clang] [clang] Informative error for lifetimebound in decl-spec (PR #118567)
Maksim Ivanov via cfe-commits
cfe-commits at lists.llvm.org
Thu Dec 5 03:32:15 PST 2024
================
@@ -3703,8 +3703,14 @@ void Parser::ParseDeclarationSpecifiers(
// We reject AT_LifetimeBound and AT_AnyX86NoCfCheck, even though they
// are type attributes, because we historically haven't allowed these
// to be used as type attributes in C++11 / C23 syntax.
- if (PA.isTypeAttr() && PA.getKind() != ParsedAttr::AT_LifetimeBound &&
- PA.getKind() != ParsedAttr::AT_AnyX86NoCfCheck)
+ if (PA.getKind() == ParsedAttr::AT_LifetimeBound) {
+ Diag(PA.getLoc(), diag::err_attribute_wrong_decl_type_str)
+ << PA << PA.isRegularKeywordAttribute()
+ << "parameters and implicit object parameters";
+ PA.setInvalid();
+ continue;
+ }
+ if (PA.isTypeAttr() && PA.getKind() != ParsedAttr::AT_AnyX86NoCfCheck)
----------------
emaxx-google wrote:
done!
https://github.com/llvm/llvm-project/pull/118567
More information about the cfe-commits
mailing list