[PATCH] D148425: [clang-repl] Correctly disambiguate dtor declarations from statements

Vassil Vassilev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Apr 30 12:45:07 PDT 2023


This revision was not accepted when it landed; it landed in state "Needs Review".
This revision was automatically updated to reflect the committed changes.
Closed by commit rG5a9abe846617: [clang-repl] Correctly disambiguate dtor declarations from statements. (authored by v.g.vassilev).
Herald added a project: clang.

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D148425/new/

https://reviews.llvm.org/D148425

Files:
  clang/lib/Parse/ParseTentative.cpp
  clang/test/Interpreter/disambiguate-decl-stmt.cpp


Index: clang/test/Interpreter/disambiguate-decl-stmt.cpp
===================================================================
--- clang/test/Interpreter/disambiguate-decl-stmt.cpp
+++ clang/test/Interpreter/disambiguate-decl-stmt.cpp
@@ -26,6 +26,10 @@
 x.I::~I();
 x = 20;
 
+struct Dtor1 {~Dtor1();};
+Dtor1::~Dtor1() { printf("Dtor1\n"); }
+Dtor1 d1;
+
 // Ctors
 
 // Deduction guide
Index: clang/lib/Parse/ParseTentative.cpp
===================================================================
--- clang/lib/Parse/ParseTentative.cpp
+++ clang/lib/Parse/ParseTentative.cpp
@@ -88,10 +88,8 @@
       }
       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;
       }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D148425.518346.patch
Type: text/x-patch
Size: 884 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230430/b3a553fd/attachment.bin>


More information about the cfe-commits mailing list