aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Parse/ParseTentative.cpp
diff options
context:
space:
mode:
authorCorentin Jabot <corentinjabot@gmail.com>2022-01-27 13:55:08 +0100
committerCorentin Jabot <corentinjabot@gmail.com>2023-10-02 14:33:02 +0200
commitaf4751738db89a142a8880c782d12d4201b222a8 (patch)
treeb58f2c515b189904f4b598a06f0af0e642343b2c /clang/lib/Parse/ParseTentative.cpp
parentbc7d88faf1a595ab59952a2054418cdd0d9eeee8 (diff)
downloadllvm-af4751738db89a142a8880c782d12d4201b222a8.zip
llvm-af4751738db89a142a8880c782d12d4201b222a8.tar.gz
llvm-af4751738db89a142a8880c782d12d4201b222a8.tar.bz2
[C++] Implement "Deducing this" (P0847R7)
This patch implements P0847R7 (partially), CWG2561 and CWG2653. Reviewed By: aaron.ballman, #clang-language-wg Differential Revision: https://reviews.llvm.org/D140828
Diffstat (limited to 'clang/lib/Parse/ParseTentative.cpp')
-rw-r--r--clang/lib/Parse/ParseTentative.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/clang/lib/Parse/ParseTentative.cpp b/clang/lib/Parse/ParseTentative.cpp
index 03c19bf..8b653b1 100644
--- a/clang/lib/Parse/ParseTentative.cpp
+++ b/clang/lib/Parse/ParseTentative.cpp
@@ -1571,6 +1571,17 @@ Parser::isCXXDeclarationSpecifier(ImplicitTypenameContext AllowImplicitTypename,
case tok::kw___vector:
return TPResult::True;
+ case tok::kw_this: {
+ // Try to parse a C++23 Explicit Object Parameter
+ // We do that in all language modes to produce a better diagnostic.
+ if (getLangOpts().CPlusPlus) {
+ RevertingTentativeParsingAction PA(*this);
+ ConsumeToken();
+ return isCXXDeclarationSpecifier(AllowImplicitTypename, BracedCastResult,
+ InvalidAsDeclSpec);
+ }
+ return TPResult::False;
+ }
case tok::annot_template_id: {
TemplateIdAnnotation *TemplateId = takeTemplateIdAnnotation(Tok);
// If lookup for the template-name found nothing, don't assume we have a