Skip to content

Commit

Permalink
[Sema] Fix missing warning on initializer lists on field initializers…
Browse files Browse the repository at this point in the history
… with overloaded operators

Differential Revision: https://reviews.llvm.org/D85574
  • Loading branch information
ZequanWu committed Aug 11, 2020
1 parent 9512525 commit 4aaa977
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
4 changes: 3 additions & 1 deletion clang/lib/Sema/SemaDeclCXX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
14 changes: 14 additions & 0 deletions clang/test/SemaCXX/uninitialized.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 4aaa977

Please sign in to comment.