[PATCH] D85574: [Sema] Fix missing warning on initializer lists on field initializers with overloaded operators

Zequan Wu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 10 19:33:41 PDT 2020


This revision was automatically updated to reflect the committed changes.
Closed by commit rG4aaa97700377: [Sema] Fix missing warning on initializer lists on field initializers with… (authored by zequanwu).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D85574

Files:
  clang/lib/Sema/SemaDeclCXX.cpp
  clang/test/SemaCXX/uninitialized.cpp


Index: clang/test/SemaCXX/uninitialized.cpp
===================================================================
--- clang/test/SemaCXX/uninitialized.cpp
+++ clang/test/SemaCXX/uninitialized.cpp
@@ -1303,6 +1303,20 @@
       d3{ d3.b, num } // expected-warning{{uninitialized}}
     {}
   };
+  
+  struct E {
+    E();
+    E foo();
+    E* operator->();
+  };
+
+  struct F { F(E); };
+
+  struct EFComposed {
+    F f;
+    E e;
+    EFComposed() : f{ e->foo() }, e() {} // expected-warning{{uninitialized}}
+  };
 }
 
 namespace template_class {
Index: clang/lib/Sema/SemaDeclCXX.cpp
===================================================================
--- clang/lib/Sema/SemaDeclCXX.cpp
+++ clang/lib/Sema/SemaDeclCXX.cpp
@@ -3577,8 +3577,10 @@
         Base = SubME->getBase();
       }
 
-      if (!isa<CXXThisExpr>(Base->IgnoreParenImpCasts()))
+      if (!isa<CXXThisExpr>(Base->IgnoreParenImpCasts())) {
+        Visit(Base);
         return;
+      }
 
       if (AddressOf && AllPODFields)
         return;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D85574.284566.patch
Type: text/x-patch
Size: 1018 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200811/d8009419/attachment.bin>


More information about the cfe-commits mailing list