summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--clang/include/clang/AST/Decl.h2
-rw-r--r--clang/test/CodeGen/typedef-func.c13
2 files changed, 14 insertions, 1 deletions
diff --git a/clang/include/clang/AST/Decl.h b/clang/include/clang/AST/Decl.h
index e3d83af4203..1bfad2e3915 100644
--- a/clang/include/clang/AST/Decl.h
+++ b/clang/include/clang/AST/Decl.h
@@ -492,7 +492,7 @@ public:
unsigned getMinRequiredArguments() const;
QualType getResultType() const {
- return cast<FunctionType>(getType())->getResultType();
+ return getType()->getAsFunctionType()->getResultType();
}
StorageClass getStorageClass() const { return StorageClass(SClass); }
bool isInline() const { return IsInline; }
diff --git a/clang/test/CodeGen/typedef-func.c b/clang/test/CodeGen/typedef-func.c
new file mode 100644
index 00000000000..08328e67700
--- /dev/null
+++ b/clang/test/CodeGen/typedef-func.c
@@ -0,0 +1,13 @@
+// RUN: clang -emit-llvm < %s
+
+// PR2414
+typedef void filter_func_t();
+filter_func_t mono_filter;
+
+void addfilter2(filter_func_t *func){}
+
+void setup_filters()
+{
+ addfilter2( mono_filter);
+}
+
OpenPOWER on IntegriCloud