diff --git a/clang/lib/Serialization/ASTReaderDecl.cpp b/clang/lib/Serialization/ASTReaderDecl.cpp index 093b69ab19d0..362b5a564ab9 100644 --- a/clang/lib/Serialization/ASTReaderDecl.cpp +++ b/clang/lib/Serialization/ASTReaderDecl.cpp @@ -555,7 +555,7 @@ void ASTDeclReader::Visit(Decl *D) { void ASTDeclReader::VisitDecl(Decl *D) { if (D->isTemplateParameter() || D->isTemplateParameterPack() || - isa(D)) { + isa(D) || isa(D)) { // We don't want to deserialize the DeclContext of a template // parameter or of a parameter of a function template immediately. These // entities might be used in the formulation of its DeclContext (for diff --git a/clang/test/Modules/Inputs/module.map b/clang/test/Modules/Inputs/module.map index 3f128c0bb0e0..ed220e667f05 100644 --- a/clang/test/Modules/Inputs/module.map +++ b/clang/test/Modules/Inputs/module.map @@ -193,6 +193,10 @@ module weird_objc { header "weird_objc.h" } +module objc_type_param { + header "objc_type_param.h" +} + module ignored_macros { header "ignored_macros.h" } diff --git a/clang/test/Modules/Inputs/objc_type_param.h b/clang/test/Modules/Inputs/objc_type_param.h new file mode 100644 index 000000000000..7728b68e28e9 --- /dev/null +++ b/clang/test/Modules/Inputs/objc_type_param.h @@ -0,0 +1,13 @@ +__attribute__((objc_root_class)) +@interface Root { + Class isa; +} +@end + +@interface A : Root +@end + +@interface B : A +typedef void (*BCallback)(T, U); ++ (id) newWithCallback: (BCallback) callback; +@end diff --git a/clang/test/Modules/objc-type-param.m b/clang/test/Modules/objc-type-param.m new file mode 100644 index 000000000000..3417d62b25ff --- /dev/null +++ b/clang/test/Modules/objc-type-param.m @@ -0,0 +1,8 @@ +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -x objective-c -fmodule-name=objc_type_param -emit-module %S/Inputs/module.map +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I %S/Inputs %s -verify + +@import objc_type_param; + +id make(BCallback callback, id arg) { + return callback(arg); // expected-error {{too few arguments to function call}} +}