forked from OSchip/llvm-project
c error recovery. treat an invalid redeclaration
of a c-function for what it is. Otherwise, this func is treated as an overloadable c-function resulting in a crash much later. // rdar://11743706 llvm-svn: 163224
This commit is contained in:
parent
6d92188ff7
commit
aaf376b4dd
|
@ -5565,6 +5565,9 @@ Sema::ActOnFunctionDeclarator(Scope *S, Declarator &D, DeclContext *DC,
|
|||
D.setRedeclaration(CheckFunctionDeclaration(S, NewFD, Previous,
|
||||
isExplicitSpecialization));
|
||||
}
|
||||
// Make graceful recovery from an invalid redeclaration.
|
||||
else if (!Previous.empty())
|
||||
D.setRedeclaration(true);
|
||||
assert((NewFD->isInvalidDecl() || !D.isRedeclaration() ||
|
||||
Previous.getResultKind() != LookupResult::FoundOverloaded) &&
|
||||
"previous declaration set still overloaded");
|
||||
|
|
|
@ -29,3 +29,12 @@ typedef struct {
|
|||
void f(StructType *buf) {
|
||||
buf->fun = 0;
|
||||
}
|
||||
|
||||
// rdar://11743706
|
||||
static void bar(hid_t, char); // expected-error {{expected identifier}}
|
||||
|
||||
static void bar(hid_t p, char); // expected-error {{unknown type name 'hid_t'}}
|
||||
|
||||
void foo() {
|
||||
(void)bar;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue