From: Douglas Gregor Date: Thu, 17 Jun 2010 16:03:49 +0000 (+0000) Subject: When pushing a copy of the TypeLoc information for a dependent X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e2872d0bda1d209d4409de2ed13648e6811628b7;p=clang When pushing a copy of the TypeLoc information for a dependent template specialization type, copy the location information but use the new type. Fixes PR7385. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@106224 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Sema/TreeTransform.h b/lib/Sema/TreeTransform.h index d2995778fc..910aadbdc8 100644 --- a/lib/Sema/TreeTransform.h +++ b/lib/Sema/TreeTransform.h @@ -3387,7 +3387,8 @@ QualType TreeTransform:: NewTL.setKeywordLoc(TL.getKeywordLoc()); NewTL.setQualifierRange(TL.getQualifierRange()); } else { - TLB.pushFullCopy(TL); + TypeLoc NewTL(Result, TL.getOpaqueData()); + TLB.pushFullCopy(NewTL); } return Result; } diff --git a/test/SemaTemplate/nested-name-spec-template.cpp b/test/SemaTemplate/nested-name-spec-template.cpp index e1e7246bd7..12ab486809 100644 --- a/test/SemaTemplate/nested-name-spec-template.cpp +++ b/test/SemaTemplate/nested-name-spec-template.cpp @@ -72,3 +72,19 @@ namespace N1 { } template T N1::f0() { } + +namespace PR7385 { + template< typename > struct has_xxx0 + { + template< typename > struct has_xxx0_introspect + { + template< typename > struct has_xxx0_substitute ; + template< typename V > + int int00( has_xxx0_substitute < typename V::template xxx< > > = 0 ); + }; + static const int value = has_xxx0_introspect::value; // expected-error{{no member named 'value'}} + typedef int type; + }; + + has_xxx0::type t; // expected-note{{instantiation of}} +}