diff --git a/clang/lib/AST/ODRHash.cpp b/clang/lib/AST/ODRHash.cpp --- a/clang/lib/AST/ODRHash.cpp +++ b/clang/lib/AST/ODRHash.cpp @@ -910,9 +910,6 @@ void VisitFunctionType(const FunctionType *T) { AddQualType(T->getReturnType()); T->getExtInfo().Profile(ID); - Hash.AddBoolean(T->isConst()); - Hash.AddBoolean(T->isVolatile()); - Hash.AddBoolean(T->isRestrict()); VisitType(T); } @@ -921,6 +918,9 @@ } void VisitFunctionProtoType(const FunctionProtoType *T) { + Hash.AddBoolean(T->isConst()); + Hash.AddBoolean(T->isVolatile()); + Hash.AddBoolean(T->isRestrict()); ID.AddInteger(T->getNumParams()); for (auto ParamType : T->getParamTypes()) AddQualType(ParamType); diff --git a/clang/test/Modules/odr_hash-record.c b/clang/test/Modules/odr_hash-record.c --- a/clang/test/Modules/odr_hash-record.c +++ b/clang/test/Modules/odr_hash-record.c @@ -381,6 +381,21 @@ struct TSS1 *tss1; #endif +// Function pointer in a struct. +#if defined(FIRST) +typedef void (*HandlerProcPtr)(); +struct Handler { + HandlerProcPtr procPtr; +}; +#elif defined(SECOND) +typedef void (*HandlerProcPtr)(); +struct Handler { + HandlerProcPtr procPtr; +}; +#else +struct Handler h; +#endif + // Keep macros contained to one file. #ifdef FIRST #undef FIRST