diff options
author | Douglas Gregor <dgregor@apple.com> | 2009-03-23 16:26:51 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2009-03-23 16:26:51 +0000 |
commit | d6b05f705b2888137615d619e9a5a4d3ce8f2f11 (patch) | |
tree | 96a35ab1ed953417a1763c1e8f0c31dc30c70ee0 | |
parent | 6ad3bc2e7f0b784924ad2927b9da2c6b3a6ab802 (diff) | |
download | bcm5719-llvm-d6b05f705b2888137615d619e9a5a4d3ce8f2f11.tar.gz bcm5719-llvm-d6b05f705b2888137615d619e9a5a4d3ce8f2f11.zip |
Tighten up the determination of whether a function declaration has a
prototype. Thanks Eli!
llvm-svn: 67533
-rw-r--r-- | clang/lib/Sema/SemaDecl.cpp | 2 | ||||
-rw-r--r-- | clang/test/Sema/function-redecl.c | 9 |
2 files changed, 10 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp index 62b9bff3def..89375d7066e 100644 --- a/clang/lib/Sema/SemaDecl.cpp +++ b/clang/lib/Sema/SemaDecl.cpp @@ -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(), diff --git a/clang/test/Sema/function-redecl.c b/clang/test/Sema/function-redecl.c index 80500664af3..fc2e1995f26 100644 --- a/clang/test/Sema/function-redecl.c +++ b/clang/test/Sema/function-redecl.c @@ -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 *'}} +} |