Tighten up the determination of whether a function declaration has a

prototype. Thanks Eli!

llvm-svn: 67533
This commit is contained in:
Douglas Gregor 2009-03-23 16:26:51 +00:00
parent 6ad3bc2e7f
commit d6b05f705b
2 changed files with 10 additions and 1 deletions

View File

@ -1895,7 +1895,7 @@ Sema::ActOnFunctionDeclarator(Scope* S, Declarator& D, DeclContext* DC,
bool HasPrototype =
getLangOptions().CPlusPlus ||
(D.getNumTypeObjects() && D.getTypeObject(0).Fun.hasPrototype) ||
!isa<FunctionType>(R.getTypePtr());
(!isa<FunctionType>(R.getTypePtr()) && R->isFunctionProtoType());
NewFD = FunctionDecl::Create(Context, DC,
D.getIdentifierLoc(),

View File

@ -116,3 +116,12 @@ extern __typeof (h1) h1 __attribute__((__sentinel__));
void i0 (unsigned short a0);
extern __typeof (i0) i1;
extern __typeof (i1) i1;
typedef int a();
typedef int a2(int*);
a x;
a2 x2;
void test_x() {
x(5);
x2(5); // expected-warning{{incompatible integer to pointer conversion passing 'int', expected 'int *'}}
}