diff options
author | Corentin Jabot <corentinjabot@gmail.com> | 2023-04-10 11:52:30 +0200 |
---|---|---|
committer | Corentin Jabot <corentinjabot@gmail.com> | 2023-04-10 17:33:09 +0200 |
commit | 1cdc0e83c8ce35702ddbc6b26959a5da44776a49 (patch) | |
tree | 7af395ec91b2d8d0b9fd2dd24c7a4b811f7f9e6a /clang/lib/Parse/ParseDecl.cpp | |
parent | 26c57df8aa3b3a134bbda3a4e3ab34625ffc7510 (diff) | |
download | llvm-1cdc0e83c8ce35702ddbc6b26959a5da44776a49.zip llvm-1cdc0e83c8ce35702ddbc6b26959a5da44776a49.tar.gz llvm-1cdc0e83c8ce35702ddbc6b26959a5da44776a49.tar.bz2 |
[Clang] Check type-constraints applied to placeholder types
(and deduced return types)
Previously, only type constraints applied to type parameter
were semantically checked.
A diagnostic would still be emitted on instantiation, but it was
too late, lacked clarity, and was inconsistent with type parameters.
Reviewed By: erichkeane
Differential Revision: https://reviews.llvm.org/D147925
Diffstat (limited to 'clang/lib/Parse/ParseDecl.cpp')
-rw-r--r-- | clang/lib/Parse/ParseDecl.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/clang/lib/Parse/ParseDecl.cpp b/clang/lib/Parse/ParseDecl.cpp index 91376cf..450c703 100644 --- a/clang/lib/Parse/ParseDecl.cpp +++ b/clang/lib/Parse/ParseDecl.cpp @@ -3770,6 +3770,10 @@ void Parser::ParseDeclarationSpecifiers( } if (!NextToken().isOneOf(tok::kw_auto, tok::kw_decltype)) goto DoneWithDeclSpec; + + if (TemplateId && !isInvalid && Actions.CheckTypeConstraint(TemplateId)) + TemplateId = nullptr; + ConsumeAnnotationToken(); SourceLocation AutoLoc = Tok.getLocation(); if (TryConsumeToken(tok::kw_decltype)) { |