[PATCH] D85716: [AST][RecoveryExpr] Fix a bogus unused diagnostic when the type is preserved.

Haojian Wu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Aug 21 06:49:35 PDT 2020


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG466590192b42: [AST][RecoveryExpr] Fix a bogus unused diagnostic when the type is preserved. (authored by hokein).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D85716

Files:
  clang/lib/AST/Expr.cpp
  clang/test/SemaCXX/recovery-expr-type.cpp


Index: clang/test/SemaCXX/recovery-expr-type.cpp
===================================================================
--- clang/test/SemaCXX/recovery-expr-type.cpp
+++ clang/test/SemaCXX/recovery-expr-type.cpp
@@ -75,3 +75,14 @@
   template<typename...Ts> U<Ts...>& f(); // expected-error {{pack expansion used as argument for non-pack parameter of alias template}}
   double &s1 = f(); // expected-error {{no matching function}}
 }
+
+namespace test6 {
+struct T {
+  T() = delete; // expected-note {{has been explicitly marked deleted here}}
+};
+
+void func() {
+  // verify that no -Wunused-value diagnostic.
+  (T(T())); // expected-error {{call to deleted constructor}}
+}
+}
Index: clang/lib/AST/Expr.cpp
===================================================================
--- clang/lib/AST/Expr.cpp
+++ clang/lib/AST/Expr.cpp
@@ -2658,6 +2658,8 @@
     // Otherwise, the result of the cast is unused.
     if (CE->getCastKind() == CK_ConstructorConversion)
       return CE->getSubExpr()->isUnusedResultAWarning(WarnE, Loc, R1, R2, Ctx);
+    if (CE->getCastKind() == CK_Dependent)
+      return false;
 
     WarnE = this;
     if (const CXXFunctionalCastExpr *CXXCE =


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D85716.287026.patch
Type: text/x-patch
Size: 1177 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200821/c951b36e/attachment-0001.bin>


More information about the cfe-commits mailing list