diff --git a/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp b/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp --- a/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp +++ b/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp @@ -953,6 +953,7 @@ SemaRef.inferGslPointerAttribute(Typedef); Typedef->setAccess(D->getAccess()); + Typedef->setReferenced(D->isReferenced()); return Typedef; } diff --git a/clang/test/AST/ast-dump-openmp-begin-declare-variant_reference.cpp b/clang/test/AST/ast-dump-openmp-begin-declare-variant_reference.cpp --- a/clang/test/AST/ast-dump-openmp-begin-declare-variant_reference.cpp +++ b/clang/test/AST/ast-dump-openmp-begin-declare-variant_reference.cpp @@ -193,7 +193,7 @@ // CHECK-NEXT: | | |-ParmVarDecl [[ADDR_43:0x[a-z0-9]*]] col:12 used __t 'float &' // CHECK-NEXT: | | `-CompoundStmt [[ADDR_44:0x[a-z0-9]*]] // CHECK-NEXT: | | |-DeclStmt [[ADDR_45:0x[a-z0-9]*]] -// CHECK-NEXT: | | | `-TypedefDecl [[ADDR_46:0x[a-z0-9]*]] col:48 _Up 'typename remove_reference::type':'float' +// CHECK-NEXT: | | | `-TypedefDecl [[ADDR_46:0x[a-z0-9]*]] col:48 referenced _Up 'typename remove_reference::type':'float' // CHECK-NEXT: | | | `-ElaboratedType [[ADDR_47:0x[a-z0-9]*]] 'typename remove_reference::type' sugar // CHECK-NEXT: | | | `-TypedefType [[ADDR_48:0x[a-z0-9]*]] 'remove_reference::type' sugar // CHECK-NEXT: | | | |-Typedef [[ADDR_10]] 'type' @@ -211,7 +211,7 @@ // CHECK-NEXT: | |-ParmVarDecl [[ADDR_53:0x[a-z0-9]*]] col:12 used __t 'short &' // CHECK-NEXT: | `-CompoundStmt [[ADDR_54:0x[a-z0-9]*]] // CHECK-NEXT: | |-DeclStmt [[ADDR_55:0x[a-z0-9]*]] -// CHECK-NEXT: | | `-TypedefDecl [[ADDR_56:0x[a-z0-9]*]] col:48 _Up 'typename remove_reference::type':'short' +// CHECK-NEXT: | | `-TypedefDecl [[ADDR_56:0x[a-z0-9]*]] col:48 referenced _Up 'typename remove_reference::type':'short' // CHECK-NEXT: | | `-ElaboratedType [[ADDR_57:0x[a-z0-9]*]] 'typename remove_reference::type' sugar // CHECK-NEXT: | | `-TypedefType [[ADDR_58:0x[a-z0-9]*]] 'remove_reference::type' sugar // CHECK-NEXT: | | |-Typedef [[ADDR_18]] 'type' diff --git a/clang/test/Modules/odr_hash.cpp b/clang/test/Modules/odr_hash.cpp --- a/clang/test/Modules/odr_hash.cpp +++ b/clang/test/Modules/odr_hash.cpp @@ -4285,6 +4285,8 @@ G* S::Foo(const G* asdf, int*) {} #else S s; +// expected-error@first.h:* {{'ParameterTest::S::Foo' has different definitions in different modules; definition in module 'FirstModule' first difference is 1st parameter with name 'aaaa'}} +// expected-note@second.h:* {{but in 'SecondModule' found 1st parameter with name 'asdf'}} #endif } // ParameterTest diff --git a/clang/test/SemaCXX/warn-unused-local-typedef.cpp b/clang/test/SemaCXX/warn-unused-local-typedef.cpp --- a/clang/test/SemaCXX/warn-unused-local-typedef.cpp +++ b/clang/test/SemaCXX/warn-unused-local-typedef.cpp @@ -238,5 +238,22 @@ a->~A_t2(); } +namespace TypedefInLocalClassOfAMemberOfTemplateClass { +template struct A { + void foo() { + struct Inner { + typedef int Int; // no-diag + typedef char Char; // expected-warning {{unused typedef 'Char'}} + Int m; + } b; + } +}; + +void foo() { + A x; + x.foo(); +} +} // TypedefInLocalClassOfTemplateClassMember + // This should not disable any warnings: #pragma clang diagnostic ignored "-Wunused-local-typedef"