Get rid of outdated code that masks type errors. Fixes PR2036.
llvm-svn: 47154
This commit is contained in:
parent
e9d0954c06
commit
78e47634b2
|
@ -258,16 +258,6 @@ FunctionDecl *Sema::MergeFunctionDecl(FunctionDecl *New, ScopedDecl *OldD) {
|
||||||
QualType OldQType = Old->getCanonicalType();
|
QualType OldQType = Old->getCanonicalType();
|
||||||
QualType NewQType = New->getCanonicalType();
|
QualType NewQType = New->getCanonicalType();
|
||||||
|
|
||||||
// This is not right, but it's a start.
|
|
||||||
// If Old is a function prototype with no defined arguments we only compare
|
|
||||||
// the return type; If arguments are defined on the prototype we validate the
|
|
||||||
// entire function type.
|
|
||||||
// FIXME: We should link up decl objects here.
|
|
||||||
if (Old->getBody() == 0) {
|
|
||||||
if (OldQType.getTypePtr()->getTypeClass() == Type::FunctionNoProto &&
|
|
||||||
Old->getResultType() == New->getResultType())
|
|
||||||
return New;
|
|
||||||
}
|
|
||||||
// Function types need to be compatible, not identical. This handles
|
// Function types need to be compatible, not identical. This handles
|
||||||
// duplicate function decls like "void f(int); void f(enum X);" properly.
|
// duplicate function decls like "void f(int); void f(enum X);" properly.
|
||||||
if (Context.functionTypesAreCompatible(OldQType, NewQType))
|
if (Context.functionTypesAreCompatible(OldQType, NewQType))
|
||||||
|
|
|
@ -13,6 +13,8 @@ void g(int (*)(const void **, const void **));
|
||||||
void g(int (*compar)()) {
|
void g(int (*compar)()) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void h(); //expected-error{{previous declaration is here}}
|
||||||
|
void h (const char *fmt, ...) {} //expected-error{{conflicting types for 'h'}}
|
||||||
|
|
||||||
// PR1965
|
// PR1965
|
||||||
int t5(b); // expected-error {{parameter list without types}}
|
int t5(b); // expected-error {{parameter list without types}}
|
||||||
|
|
Loading…
Reference in New Issue