[clang] 4aaa977 - [Sema] Fix missing warning on initializer lists on field initializers with overloaded operators
Zequan Wu via cfe-commits
cfe-commits at lists.llvm.org
Mon Aug 10 19:33:29 PDT 2020
Author: Zequan Wu
Date: 2020-08-10T19:32:59-07:00
New Revision: 4aaa97700377a811dbcaf88a81ec068a5b517a4d
URL: https://github.com/llvm/llvm-project/commit/4aaa97700377a811dbcaf88a81ec068a5b517a4d
DIFF: https://github.com/llvm/llvm-project/commit/4aaa97700377a811dbcaf88a81ec068a5b517a4d.diff
LOG: [Sema] Fix missing warning on initializer lists on field initializers with overloaded operators
Differential Revision: https://reviews.llvm.org/D85574
Added:
Modified:
clang/lib/Sema/SemaDeclCXX.cpp
clang/test/SemaCXX/uninitialized.cpp
Removed:
################################################################################
diff --git a/clang/lib/Sema/SemaDeclCXX.cpp b/clang/lib/Sema/SemaDeclCXX.cpp
index 057062a7372f..ea3f6786d151 100644
--- a/clang/lib/Sema/SemaDeclCXX.cpp
+++ b/clang/lib/Sema/SemaDeclCXX.cpp
@@ -3577,8 +3577,10 @@ namespace {
Base = SubME->getBase();
}
- if (!isa<CXXThisExpr>(Base->IgnoreParenImpCasts()))
+ if (!isa<CXXThisExpr>(Base->IgnoreParenImpCasts())) {
+ Visit(Base);
return;
+ }
if (AddressOf && AllPODFields)
return;
diff --git a/clang/test/SemaCXX/uninitialized.cpp b/clang/test/SemaCXX/uninitialized.cpp
index cdfcb2a9cbed..0c7b13a56ee8 100644
--- a/clang/test/SemaCXX/uninitialized.cpp
+++ b/clang/test/SemaCXX/uninitialized.cpp
@@ -1303,6 +1303,20 @@ namespace init_list {
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 {
More information about the cfe-commits
mailing list