Implicit methods for structs can confuse the warning, so exclude checking
the Decl's that are implicit. Implicit Decl's for lambdas still need to
be checked, so skipping all implicit Decl's won't work.
Differential Revision: https://reviews.llvm.org/D79548
isa<EnumDecl>(D))
continue;
auto *MemberRD = dyn_cast<CXXRecordDecl>(D);
- if (!MemberRD)
+ if (!MemberRD) {
+ if (D->isImplicit())
+ continue;
return {NonCLikeKind::OtherMember, D->getSourceRange()};
+ }
// -- contain a lambda-expression,
if (MemberRD->isLambda())
int arr[&f<X> ? 1 : 2];
} C; // expected-note {{by this typedef}}
}
+
+namespace ImplicitDecls {
+struct Destructor {
+ ~Destructor() {}
+};
+typedef struct {
+} Empty;
+
+typedef struct {
+ Destructor x;
+} A;
+
+typedef struct {
+ Empty E;
+} B;
+
+typedef struct {
+ const Empty E;
+} C;
+} // namespace ImplicitDecls