1. In a struct field redefinition, don't mark the struct erroneous. The
field is erroneous, but the struct is otherwise well formed.
2. Don't emit diagnostics about functions that are known to be broken already.
Either fix is sufficient to silence the second diagnostic in the example,
but the combination is better :)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70371
91177308-0d34-0410-b5e6-
96231b3b80d8
// (C99 6.9.1p3, C++ [dcl.fct]p6).
QualType ResultType = FD->getResultType();
if (!ResultType->isDependentType() && !ResultType->isVoidType() &&
+ !FD->isInvalidDecl() &&
RequireCompleteType(FD->getLocation(), ResultType,
diag::err_func_def_incomplete_result))
FD->setInvalidDecl();
Diag(Loc, diag::err_duplicate_member) << II;
Diag(PrevDecl->getLocation(), diag::note_previous_declaration);
NewFD->setInvalidDecl();
- Record->setInvalidDecl();
}
if (getLangOptions().CPlusPlus && !T->isPODType())
char data;
};
+
+// PR4092
+struct s0 {
+ char a; // expected-note {{previous declaration is here}}
+ char a; // expected-error {{duplicate member 'a'}}
+};
+
+struct s0 f0(void) {}