[clang] 5a9abe8 - [clang-repl] Correctly disambiguate dtor declarations from statements.
Vassil Vassilev via cfe-commits
cfe-commits at lists.llvm.org
Sun Apr 30 12:45:01 PDT 2023
Author: Vassil Vassilev
Date: 2023-04-30T19:44:52Z
New Revision: 5a9abe846617efea4a128134db0915a044d7dd73
URL: https://github.com/llvm/llvm-project/commit/5a9abe846617efea4a128134db0915a044d7dd73
DIFF: https://github.com/llvm/llvm-project/commit/5a9abe846617efea4a128134db0915a044d7dd73.diff
LOG: [clang-repl] Correctly disambiguate dtor declarations from statements.
Differential revision: https://reviews.llvm.org/D148425
Added:
Modified:
clang/lib/Parse/ParseTentative.cpp
clang/test/Interpreter/disambiguate-decl-stmt.cpp
Removed:
################################################################################
diff --git a/clang/lib/Parse/ParseTentative.cpp b/clang/lib/Parse/ParseTentative.cpp
index b26faaff7f9f3..934087e59b809 100644
--- a/clang/lib/Parse/ParseTentative.cpp
+++ b/clang/lib/Parse/ParseTentative.cpp
@@ -88,10 +88,8 @@ bool Parser::isCXXDeclarationStatement(
}
case tok::kw_operator:
return true;
- case tok::annot_cxxscope: // Check if this is a dtor.
- if (NextToken().is(tok::tilde))
- return true;
- break;
+ case tok::tilde:
+ return true;
default:
break;
}
diff --git a/clang/test/Interpreter/disambiguate-decl-stmt.cpp b/clang/test/Interpreter/disambiguate-decl-stmt.cpp
index 0022ad7f546e6..8f8a2a91b0b35 100644
--- a/clang/test/Interpreter/disambiguate-decl-stmt.cpp
+++ b/clang/test/Interpreter/disambiguate-decl-stmt.cpp
@@ -26,6 +26,10 @@ I x = 10;
x.I::~I();
x = 20;
+struct Dtor1 {~Dtor1();};
+Dtor1::~Dtor1() { printf("Dtor1\n"); }
+Dtor1 d1;
+
// Ctors
// Deduction guide
More information about the cfe-commits
mailing list