diff options
author | Eli Friedman <eli.friedman@gmail.com> | 2008-02-15 06:56:02 +0000 |
---|---|---|
committer | Eli Friedman <eli.friedman@gmail.com> | 2008-02-15 06:56:02 +0000 |
commit | f963339f63e37057c7f397b3ecf5bfb49f6b48b9 (patch) | |
tree | cd5fc117660bdb34eecc4804f4f264d024a7b4cb | |
parent | 708eed500a73a2b85a9f5435efbf57b882339f3d (diff) |
Get rid of outdated code that masks type errors. Fixes PR2036.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47154 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | Sema/SemaDecl.cpp | 10 | ||||
-rw-r--r-- | test/Sema/function.c | 2 |
2 files changed, 2 insertions, 10 deletions
diff --git a/Sema/SemaDecl.cpp b/Sema/SemaDecl.cpp index b14e20b2c3..fc60a7a4aa 100644 --- a/Sema/SemaDecl.cpp +++ b/Sema/SemaDecl.cpp @@ -258,16 +258,6 @@ FunctionDecl *Sema::MergeFunctionDecl(FunctionDecl *New, ScopedDecl *OldD) { QualType OldQType = Old->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 // duplicate function decls like "void f(int); void f(enum X);" properly. if (Context.functionTypesAreCompatible(OldQType, NewQType)) diff --git a/test/Sema/function.c b/test/Sema/function.c index a75814ee45..8ef453581f 100644 --- a/test/Sema/function.c +++ b/test/Sema/function.c @@ -13,6 +13,8 @@ void g(int (*)(const void **, const void **)); void g(int (*compar)()) { } +void h(); //expected-error{{previous declaration is here}} +void h (const char *fmt, ...) {} //expected-error{{conflicting types for 'h'}} // PR1965 int t5(b); // expected-error {{parameter list without types}} |