If a function is declared as, e.g.,
F f;
where F is a typedef of a function type, then the function "f" has a
prototype. This is a slight tweak to Chris's suggested fix in
PR3817. Fixes PR3817 and PR3840.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67313 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp
index 18d55d9..a503811 100644
--- a/lib/Sema/SemaDecl.cpp
+++ b/lib/Sema/SemaDecl.cpp
@@ -1864,9 +1864,10 @@
isVirtualOkay = (SC != FunctionDecl::Static);
} else {
- bool HasPrototype =
+ bool HasPrototype =
getLangOptions().CPlusPlus ||
- (D.getNumTypeObjects() && D.getTypeObject(0).Fun.hasPrototype);
+ (D.getNumTypeObjects() && D.getTypeObject(0).Fun.hasPrototype) ||
+ !isa<FunctionType>(R.getTypePtr());
NewFD = FunctionDecl::Create(Context, DC,
D.getIdentifierLoc(),