[cfe-commits] r47154 - in /cfe/trunk: Sema/SemaDecl.cpp test/Sema/function.c

Eli Friedman eli.friedman at gmail.com
Thu Feb 14 22:56:02 PST 2008


Author: efriedma
Date: Fri Feb 15 00:56:02 2008
New Revision: 47154

URL: http://llvm.org/viewvc/llvm-project?rev=47154&view=rev
Log:
Get rid of outdated code that masks type errors. Fixes PR2036.

Modified:
    cfe/trunk/Sema/SemaDecl.cpp
    cfe/trunk/test/Sema/function.c

Modified: cfe/trunk/Sema/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Sema/SemaDecl.cpp?rev=47154&r1=47153&r2=47154&view=diff

==============================================================================
--- cfe/trunk/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/Sema/SemaDecl.cpp Fri Feb 15 00:56:02 2008
@@ -258,16 +258,6 @@
   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))

Modified: cfe/trunk/test/Sema/function.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/function.c?rev=47154&r1=47153&r2=47154&view=diff

==============================================================================
--- cfe/trunk/test/Sema/function.c (original)
+++ cfe/trunk/test/Sema/function.c Fri Feb 15 00:56:02 2008
@@ -13,6 +13,8 @@
 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}}





More information about the cfe-commits mailing list