diff --git a/clang/lib/AST/ByteCode/Pointer.h b/clang/lib/AST/ByteCode/Pointer.h index f310c8a7b66be..0ce54ab0a17df 100644 --- a/clang/lib/AST/ByteCode/Pointer.h +++ b/clang/lib/AST/ByteCode/Pointer.h @@ -341,6 +341,8 @@ class Pointer { QualType getType() const { if (isTypeidPointer()) return QualType(Typeid.TypeInfoType, 0); + if (isFunctionPointer()) + return asFunctionPointer().getFunction()->getDecl()->getType(); if (inPrimitiveArray() && Offset != asBlockPointer().Base) { // Unfortunately, complex and vector types are not array types in clang, diff --git a/clang/test/AST/ByteCode/functions.cpp b/clang/test/AST/ByteCode/functions.cpp index 4f090842510e0..01bf0a55bd19a 100644 --- a/clang/test/AST/ByteCode/functions.cpp +++ b/clang/test/AST/ByteCode/functions.cpp @@ -732,3 +732,8 @@ namespace LocalVarForParmVarDecl { } static_assert(foo(), ""); } + +namespace PtrPtrCast { + void foo() { ; } + void bar(int *a) { a = (int *)(void *)(foo); } +}