aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/Sema/SemaDecl.cpp2
-rw-r--r--test/Sema/function-redecl.c9
2 files changed, 10 insertions, 1 deletions
diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp
index 62b9bff3de..89375d7066 100644
--- a/lib/Sema/SemaDecl.cpp
+++ b/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/test/Sema/function-redecl.c b/test/Sema/function-redecl.c
index 80500664af..fc2e1995f2 100644
--- a/test/Sema/function-redecl.c
+++ b/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 *'}}
+}