<div dir="ltr">Thanks for the revert; fixed and re-committed as r293544.</div><div class="gmail_extra"><br><div class="gmail_quote">On 30 January 2017 at 02:44, Sam McCall via cfe-commits <span dir="ltr"><<a href="mailto:cfe-commits@lists.llvm.org" target="_blank">cfe-commits@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: sammccall<br>
Date: Mon Jan 30 04:44:11 2017<br>
New Revision: 293473<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=293473&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project?rev=293473&view=rev</a><br>
Log:<br>
Revert r293455, which breaks v8 with a spurious error. Testcase added.<br>
<br>
Summary: Revert r293455, which breaks v8 with a spurious error. Testcase added.<br>
<br>
Reviewers: klimek<br>
<br>
Subscribers: cfe-commits, rsmith<br>
<br>
Differential Revision: <a href="https://reviews.llvm.org/D29271" rel="noreferrer" target="_blank">https://reviews.llvm.org/<wbr>D29271</a><br>
<br>
Modified:<br>
cfe/trunk/include/clang/AST/<wbr>DeclTemplate.h<br>
cfe/trunk/include/clang/Basic/<wbr>DiagnosticSemaKinds.td<br>
cfe/trunk/include/clang/Sema/<wbr>Sema.h<br>
cfe/trunk/lib/Sema/SemaDecl.<wbr>cpp<br>
cfe/trunk/lib/Sema/<wbr>SemaTemplate.cpp<br>
cfe/trunk/lib/Sema/<wbr>SemaTemplateInstantiate.cpp<br>
cfe/trunk/lib/Sema/<wbr>SemaTemplateInstantiateDecl.<wbr>cpp<br>
cfe/trunk/lib/Sema/<wbr>TreeTransform.h<br>
cfe/trunk/test/Parser/cxx1z-<wbr>class-template-argument-<wbr>deduction.cpp<br>
cfe/trunk/test/SemaCXX/cxx0x-<wbr>class.cpp<br>
<br>
Modified: cfe/trunk/include/clang/AST/<wbr>DeclTemplate.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/DeclTemplate.h?rev=293473&r1=293472&r2=293473&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/cfe/trunk/include/<wbr>clang/AST/DeclTemplate.h?rev=<wbr>293473&r1=293472&r2=293473&<wbr>view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- cfe/trunk/include/clang/AST/<wbr>DeclTemplate.h (original)<br>
+++ cfe/trunk/include/clang/AST/<wbr>DeclTemplate.h Mon Jan 30 04:44:11 2017<br>
@@ -2946,16 +2946,6 @@ inline NamedDecl *getAsNamedDecl(Templat<br>
return P.get<<wbr>TemplateTemplateParmDecl*>();<br>
}<br>
<br>
-inline TemplateDecl *getAsTypeTemplateDecl(Decl *D) {<br>
- auto *TD = dyn_cast<TemplateDecl>(D);<br>
- return TD && (isa<ClassTemplateDecl>(TD) ||<br>
- isa<<wbr>ClassTemplatePartialSpecializa<wbr>tionDecl>(TD) ||<br>
- isa<TypeAliasTemplateDecl>(TD) ||<br>
- isa<TemplateTemplateParmDecl>(<wbr>TD))<br>
- ? TD<br>
- : nullptr;<br>
-}<br>
-<br>
} /* end of namespace clang */<br>
<br>
#endif<br>
<br>
Modified: cfe/trunk/include/clang/Basic/<wbr>DiagnosticSemaKinds.td<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=293473&r1=293472&r2=293473&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/cfe/trunk/include/<wbr>clang/Basic/<wbr>DiagnosticSemaKinds.td?rev=<wbr>293473&r1=293472&r2=293473&<wbr>view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- cfe/trunk/include/clang/Basic/<wbr>DiagnosticSemaKinds.td (original)<br>
+++ cfe/trunk/include/clang/Basic/<wbr>DiagnosticSemaKinds.td Mon Jan 30 04:44:11 2017<br>
@@ -1884,11 +1884,6 @@ def err_auto_not_allowed : Error<<br>
"|in conversion function type|here|in lambda parameter"<br>
"|in type allocated by 'new'|in K&R-style function parameter"<br>
"|in template parameter|in friend declaration}1">;<br>
-def err_dependent_deduced_tst : Error<<br>
- "typename specifier refers to "<br>
- "%select{class template|function template|variable template|alias template|"<br>
- "template template parameter|template}0 member in %1; "<br>
- "argument deduction not allowed here">;<br>
def err_auto_not_allowed_var_inst : Error<<br>
"'auto' variable template instantiation is not allowed">;<br>
def err_auto_var_requires_init : Error<<br>
<br>
Modified: cfe/trunk/include/clang/Sema/<wbr>Sema.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/Sema.h?rev=293473&r1=293472&r2=293473&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/cfe/trunk/include/<wbr>clang/Sema/Sema.h?rev=293473&<wbr>r1=293472&r2=293473&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- cfe/trunk/include/clang/Sema/<wbr>Sema.h (original)<br>
+++ cfe/trunk/include/clang/Sema/<wbr>Sema.h Mon Jan 30 04:44:11 2017<br>
@@ -7359,8 +7359,7 @@ public:<br>
<br>
TypeSourceInfo *SubstType(TypeSourceInfo *T,<br>
const MultiLevelTemplateArgumentList &TemplateArgs,<br>
- SourceLocation Loc, DeclarationName Entity,<br>
- bool AllowDeducedTST = false);<br>
+ SourceLocation Loc, DeclarationName Entity);<br>
<br>
QualType SubstType(QualType T,<br>
const MultiLevelTemplateArgumentList &TemplateArgs,<br>
<br>
Modified: cfe/trunk/lib/Sema/SemaDecl.<wbr>cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=293473&r1=293472&r2=293473&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/cfe/trunk/lib/Sema/<wbr>SemaDecl.cpp?rev=293473&r1=<wbr>293472&r2=293473&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- cfe/trunk/lib/Sema/SemaDecl.<wbr>cpp (original)<br>
+++ cfe/trunk/lib/Sema/SemaDecl.<wbr>cpp Mon Jan 30 04:44:11 2017<br>
@@ -60,6 +60,11 @@ Sema::DeclGroupPtrTy Sema::ConvertDeclTo<br>
return DeclGroupPtrTy::make(<wbr>DeclGroupRef(Ptr));<br>
}<br>
<br>
+static bool isTypeTemplate(NamedDecl *ND) {<br>
+ return isa<ClassTemplateDecl>(ND) || isa<TypeAliasTemplateDecl>(ND) ||<br>
+ isa<TemplateTemplateParmDecl>(<wbr>ND);<br>
+}<br>
+<br>
namespace {<br>
<br>
class TypeNameValidatorCCC : public CorrectionCandidateCallback {<br>
@@ -76,7 +81,7 @@ class TypeNameValidatorCCC : public Corr<br>
bool ValidateCandidate(const TypoCorrection &candidate) override {<br>
if (NamedDecl *ND = candidate.getCorrectionDecl()) {<br>
bool IsType = isa<TypeDecl>(ND) || isa<ObjCInterfaceDecl>(ND);<br>
- bool AllowedTemplate = AllowTemplates && getAsTypeTemplateDecl(ND);<br>
+ bool AllowedTemplate = AllowTemplates && isTypeTemplate(ND);<br>
return (IsType || AllowedTemplate) &&<br>
(AllowInvalidDecl || !ND->isInvalidDecl());<br>
}<br>
@@ -400,7 +405,7 @@ ParsedType Sema::getTypeName(const Ident<br>
for (LookupResult::iterator Res = Result.begin(), ResEnd = Result.end();<br>
Res != ResEnd; ++Res) {<br>
if (isa<TypeDecl>(*Res) || isa<ObjCInterfaceDecl>(*Res) ||<br>
- (AllowDeducedTemplate && getAsTypeTemplateDecl(*Res))) {<br>
+ (AllowDeducedTemplate && isTypeTemplate(*Res))) {<br>
if (!IIDecl ||<br>
(*Res)->getLocation().<wbr>getRawEncoding() <<br>
IIDecl->getLocation().<wbr>getRawEncoding())<br>
@@ -453,10 +458,9 @@ ParsedType Sema::getTypeName(const Ident<br>
(void)DiagnoseUseOfDecl(IDecl, NameLoc);<br>
if (!HasTrailingDot)<br>
T = Context.getObjCInterfaceType(<wbr>IDecl);<br>
- } else if (AllowDeducedTemplate) {<br>
- if (auto *TD = getAsTypeTemplateDecl(IIDecl))<br>
- T = Context.<wbr>getDeducedTemplateSpecializati<wbr>onType(TemplateName(TD),<br>
- QualType(), false);<br>
+ } else if (AllowDeducedTemplate && isTypeTemplate(IIDecl)) {<br>
+ T = Context.<wbr>getDeducedTemplateSpecializati<wbr>onType(<br>
+ TemplateName(cast<<wbr>TemplateDecl>(IIDecl)), QualType(), false);<br>
}<br>
<br>
if (T.isNull()) {<br>
<br>
Modified: cfe/trunk/lib/Sema/<wbr>SemaTemplate.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaTemplate.cpp?rev=293473&r1=293472&r2=293473&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/cfe/trunk/lib/Sema/<wbr>SemaTemplate.cpp?rev=293473&<wbr>r1=293472&r2=293473&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- cfe/trunk/lib/Sema/<wbr>SemaTemplate.cpp (original)<br>
+++ cfe/trunk/lib/Sema/<wbr>SemaTemplate.cpp Mon Jan 30 04:44:11 2017<br>
@@ -8792,18 +8792,8 @@ Sema::CheckTypenameType(<wbr>ElaboratedTypeKe<br>
Context.getTypeDeclType(Type))<wbr>;<br>
}<br>
<br>
- // C++ [dcl.type.simple]p2:<br>
- // A type-specifier of the form<br>
- // typename[opt] nested-name-specifier[opt] template-name<br>
- // is a placeholder for a deduced class type [...].<br>
- if (getLangOpts().CPlusPlus1z) {<br>
- if (auto *TD = getAsTypeTemplateDecl(Result.<wbr>getFoundDecl())) {<br>
- return Context.getElaboratedType(<br>
- Keyword, QualifierLoc.<wbr>getNestedNameSpecifier(),<br>
- Context.<wbr>getDeducedTemplateSpecializati<wbr>onType(TemplateName(TD),<br>
- QualType(), false));<br>
- }<br>
- }<br>
+ // FIXME: Form a deduced template specialization type if we get a template<br>
+ // declaration here.<br>
<br>
DiagID = diag::err_typename_nested_not_<wbr>type;<br>
Referenced = Result.getFoundDecl();<br>
<br>
Modified: cfe/trunk/lib/Sema/<wbr>SemaTemplateInstantiate.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp?rev=293473&r1=293472&r2=293473&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/cfe/trunk/lib/Sema/<wbr>SemaTemplateInstantiate.cpp?<wbr>rev=293473&r1=293472&r2=<wbr>293473&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- cfe/trunk/lib/Sema/<wbr>SemaTemplateInstantiate.cpp (original)<br>
+++ cfe/trunk/lib/Sema/<wbr>SemaTemplateInstantiate.cpp Mon Jan 30 04:44:11 2017<br>
@@ -1490,16 +1490,12 @@ TemplateInstantiator::<wbr>TransformSubstTemp<br>
/// a cast expression) or that the entity has no name (e.g., an<br>
/// unnamed function parameter).<br>
///<br>
-/// \param AllowDeducedTST Whether a DeducedTemplateSpecializationT<wbr>ype is<br>
-/// acceptable as the top level type of the result.<br>
-///<br>
/// \returns If the instantiation succeeds, the instantiated<br>
/// type. Otherwise, produces diagnostics and returns a NULL type.<br>
TypeSourceInfo *Sema::SubstType(<wbr>TypeSourceInfo *T,<br>
const MultiLevelTemplateArgumentList &Args,<br>
SourceLocation Loc,<br>
- DeclarationName Entity,<br>
- bool AllowDeducedTST) {<br>
+ DeclarationName Entity) {<br>
assert(!<wbr>ActiveTemplateInstantiations.<wbr>empty() &&<br>
"Cannot perform an instantiation without some context on the "<br>
"instantiation stack");<br>
@@ -1509,8 +1505,7 @@ TypeSourceInfo *Sema::SubstType(TypeSour<br>
return T;<br>
<br>
TemplateInstantiator Instantiator(*this, Args, Loc, Entity);<br>
- return AllowDeducedTST ? Instantiator.<wbr>TransformTypeWithDeducedTST(T)<br>
- : Instantiator.TransformType(T);<br>
+ return Instantiator.TransformType(T);<br>
}<br>
<br>
TypeSourceInfo *Sema::SubstType(TypeLoc TL,<br>
<br>
Modified: cfe/trunk/lib/Sema/<wbr>SemaTemplateInstantiateDecl.<wbr>cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp?rev=293473&r1=293472&r2=293473&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/cfe/trunk/lib/Sema/<wbr>SemaTemplateInstantiateDecl.<wbr>cpp?rev=293473&r1=293472&r2=<wbr>293473&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- cfe/trunk/lib/Sema/<wbr>SemaTemplateInstantiateDecl.<wbr>cpp (original)<br>
+++ cfe/trunk/lib/Sema/<wbr>SemaTemplateInstantiateDecl.<wbr>cpp Mon Jan 30 04:44:11 2017<br>
@@ -657,9 +657,10 @@ Decl *TemplateDeclInstantiator::<wbr>VisitVar<br>
ArrayRef<BindingDecl*> *Bindings) {<br>
<br>
// Do substitution on the type of the declaration<br>
- TypeSourceInfo *DI = SemaRef.SubstType(<br>
- D->getTypeSourceInfo(), TemplateArgs, D->getTypeSpecStartLoc(),<br>
- D->getDeclName(), /*AllowDeducedTST*/true);<br>
+ TypeSourceInfo *DI = SemaRef.SubstType(D-><wbr>getTypeSourceInfo(),<br>
+ TemplateArgs,<br>
+ D->getTypeSpecStartLoc(),<br>
+ D->getDeclName());<br>
if (!DI)<br>
return nullptr;<br>
<br>
<br>
Modified: cfe/trunk/lib/Sema/<wbr>TreeTransform.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/TreeTransform.h?rev=293473&r1=293472&r2=293473&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/cfe/trunk/lib/Sema/<wbr>TreeTransform.h?rev=293473&r1=<wbr>293472&r2=293473&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- cfe/trunk/lib/Sema/<wbr>TreeTransform.h (original)<br>
+++ cfe/trunk/lib/Sema/<wbr>TreeTransform.h Mon Jan 30 04:44:11 2017<br>
@@ -307,17 +307,6 @@ public:<br>
///<br>
QualType TransformType(TypeLocBuilder &TLB, TypeLoc TL);<br>
<br>
- /// \brief Transform a type that is permitted to produce a<br>
- /// DeducedTemplateSpecializationT<wbr>ype.<br>
- ///<br>
- /// This is used in the (relatively rare) contexts where it is acceptable<br>
- /// for transformation to produce a class template type with deduced<br>
- /// template arguments.<br>
- /// @{<br>
- QualType TransformTypeWithDeducedTST(<wbr>QualType T);<br>
- TypeSourceInfo *TransformTypeWithDeducedTST(<wbr>TypeSourceInfo *DI);<br>
- /// @}<br>
-<br>
/// \brief Transform the given statement.<br>
///<br>
/// By default, this routine transforms a statement by delegating to the<br>
@@ -909,7 +898,7 @@ public:<br>
/// By default, builds a new ParenType type from the inner type.<br>
/// Subclasses may override this routine to provide different behavior.<br>
QualType RebuildParenType(QualType InnerType) {<br>
- return SemaRef.BuildParenType(<wbr>InnerType);<br>
+ return SemaRef.Context.getParenType(<wbr>InnerType);<br>
}<br>
<br>
/// \brief Build a new qualified name type.<br>
@@ -979,8 +968,7 @@ public:<br>
SourceLocation KeywordLoc,<br>
NestedNameSpecifierLoc QualifierLoc,<br>
const IdentifierInfo *Id,<br>
- SourceLocation IdLoc,<br>
- bool DeducedTSTContext) {<br>
+ SourceLocation IdLoc) {<br>
CXXScopeSpec SS;<br>
SS.Adopt(QualifierLoc);<br>
<br>
@@ -992,25 +980,9 @@ public:<br>
Id);<br>
}<br>
<br>
- if (Keyword == ETK_None || Keyword == ETK_Typename) {<br>
- QualType T = SemaRef.CheckTypenameType(<wbr>Keyword, KeywordLoc, QualifierLoc,<br>
- *Id, IdLoc);<br>
- // If a dependent name resolves to a deduced template specialization type,<br>
- // check that we're in one of the syntactic contexts permitting it.<br>
- if (!DeducedTSTContext) {<br>
- if (auto *Deduced = dyn_cast_or_null<<wbr>DeducedTemplateSpecializationT<wbr>ype>(<br>
- T.isNull() ? nullptr : T->getContainedDeducedType())) {<br>
- SemaRef.Diag(IdLoc, diag::err_dependent_deduced_<wbr>tst)<br>
- << (int)SemaRef.<wbr>getTemplateNameKindForDiagnost<wbr>ics(<br>
- Deduced->getTemplateName())<br>
- << QualType(QualifierLoc.<wbr>getNestedNameSpecifier()-><wbr>getAsType(), 0);<br>
- if (auto *TD = Deduced->getTemplateName().<wbr>getAsTemplateDecl())<br>
- SemaRef.Diag(TD->getLocation()<wbr>, diag::note_template_decl_here)<wbr>;<br>
- return QualType();<br>
- }<br>
- }<br>
- return T;<br>
- }<br>
+ if (Keyword == ETK_None || Keyword == ETK_Typename)<br>
+ return SemaRef.CheckTypenameType(<wbr>Keyword, KeywordLoc, QualifierLoc,<br>
+ *Id, IdLoc);<br>
<br>
TagTypeKind Kind = TypeWithKeyword::<wbr>getTagTypeKindForKeyword(<wbr>Keyword);<br>
<br>
@@ -3185,10 +3157,6 @@ private:<br>
TypeSourceInfo *TransformTSIInObjectScope(<wbr>TypeLoc TL, QualType ObjectType,<br>
NamedDecl *FirstQualifierInScope,<br>
CXXScopeSpec &SS);<br>
-<br>
- QualType TransformDependentNameType(<wbr>TypeLocBuilder &TLB,<br>
- DependentNameTypeLoc TL,<br>
- bool DeducibleTSTContext);<br>
};<br>
<br>
template<typename Derived><br>
@@ -4080,52 +4048,6 @@ TreeTransform<Derived>::<wbr>TransformType(Ty<br>
llvm_unreachable("unhandled type loc!");<br>
}<br>
<br>
-template<typename Derived><br>
-QualType TreeTransform<Derived>::<wbr>TransformTypeWithDeducedTST(<wbr>QualType T) {<br>
- if (!isa<DependentNameType>(T))<br>
- return TransformType(T);<br>
-<br>
- if (getDerived().<wbr>AlreadyTransformed(T))<br>
- return T;<br>
- TypeSourceInfo *DI = getSema().Context.<wbr>getTrivialTypeSourceInfo(T,<br>
- getDerived().getBaseLocation()<wbr>);<br>
- TypeSourceInfo *NewDI = getDerived().<wbr>TransformTypeWithDeducedTST(<wbr>DI);<br>
- return NewDI ? NewDI->getType() : QualType();<br>
-}<br>
-<br>
-template<typename Derived><br>
-TypeSourceInfo *<br>
-TreeTransform<Derived>::<wbr>TransformTypeWithDeducedTST(<wbr>TypeSourceInfo *DI) {<br>
- if (!isa<DependentNameType>(DI-><wbr>getType()))<br>
- return TransformType(DI);<br>
-<br>
- // Refine the base location to the type's location.<br>
- TemporaryBase Rebase(*this, DI->getTypeLoc().getBeginLoc()<wbr>,<br>
- getDerived().getBaseEntity());<br>
- if (getDerived().<wbr>AlreadyTransformed(DI-><wbr>getType()))<br>
- return DI;<br>
-<br>
- TypeLocBuilder TLB;<br>
-<br>
- TypeLoc TL = DI->getTypeLoc();<br>
- TLB.reserve(TL.<wbr>getFullDataSize());<br>
-<br>
- Qualifiers Quals;<br>
- if (auto QTL = TL.getAs<QualifiedTypeLoc>()) {<br>
- Quals = QTL.getType().<wbr>getLocalQualifiers();<br>
- TL = QTL.getUnqualifiedLoc();<br>
- }<br>
-<br>
- auto DNTL = TL.castAs<<wbr>DependentNameTypeLoc>();<br>
-<br>
- QualType Result = getDerived().<wbr>TransformDependentNameType(<br>
- TLB, DNTL, /*DeducedTSTContext*/true);<br>
- if (Result.isNull())<br>
- return nullptr;<br>
-<br>
- return TLB.getTypeSourceInfo(SemaRef.<wbr>Context, Result);<br>
-}<br>
-<br>
/// FIXME: By default, this routine adds type qualifiers only to types<br>
/// that can have qualifiers, and silently suppresses those qualifiers<br>
/// that are not permitted (e.g., qualifiers on reference or function<br>
@@ -5932,14 +5854,8 @@ TreeTransform<Derived>::<wbr>TransformParenTy<br>
}<br>
<br>
template<typename Derived><br>
-QualType TreeTransform<Derived>::<wbr>TransformDependentNameType(<br>
- TypeLocBuilder &TLB, DependentNameTypeLoc TL) {<br>
- return TransformDependentNameType(<wbr>TLB, TL, false);<br>
-}<br>
-<br>
-template<typename Derived><br>
-QualType TreeTransform<Derived>::<wbr>TransformDependentNameType(<br>
- TypeLocBuilder &TLB, DependentNameTypeLoc TL, bool DeducedTSTContext) {<br>
+QualType TreeTransform<Derived>::<wbr>TransformDependentNameType(<wbr>TypeLocBuilder &TLB,<br>
+ DependentNameTypeLoc TL) {<br>
const DependentNameType *T = TL.getTypePtr();<br>
<br>
NestedNameSpecifierLoc QualifierLoc<br>
@@ -5952,8 +5868,7 @@ QualType TreeTransform<Derived>::<wbr>Transfo<br>
TL.getElaboratedKeywordLoc(),<br>
QualifierLoc,<br>
T->getIdentifier(),<br>
- TL.getNameLoc(),<br>
- DeducedTSTContext);<br>
+ TL.getNameLoc());<br>
if (Result.isNull())<br>
return QualType();<br>
<br>
@@ -9559,8 +9474,7 @@ template<typename Derived><br>
ExprResult<br>
TreeTransform<Derived>::<wbr>TransformCXXFunctionalCastExpr<wbr>(<br>
CXXFunctionalCastExpr *E) {<br>
- TypeSourceInfo *Type =<br>
- getDerived().<wbr>TransformTypeWithDeducedTST(E-<wbr>>getTypeInfoAsWritten());<br>
+ TypeSourceInfo *Type = getDerived().TransformType(E-><wbr>getTypeInfoAsWritten());<br>
if (!Type)<br>
return ExprError();<br>
<br>
@@ -9749,8 +9663,8 @@ template<typename Derived><br>
ExprResult<br>
TreeTransform<Derived>::<wbr>TransformCXXNewExpr(CXXNewExpr *E) {<br>
// Transform the type that we're allocating<br>
- TypeSourceInfo *AllocTypeInfo =<br>
- getDerived().<wbr>TransformTypeWithDeducedTST(E-<wbr>>getAllocatedTypeSourceInfo())<wbr>;<br>
+ TypeSourceInfo *AllocTypeInfo<br>
+ = getDerived().TransformType(E-><wbr>getAllocatedTypeSourceInfo());<br>
if (!AllocTypeInfo)<br>
return ExprError();<br>
<br>
@@ -10461,8 +10375,7 @@ template<typename Derived><br>
ExprResult<br>
TreeTransform<Derived>::<wbr>TransformCXXTemporaryObjectExp<wbr>r(<br>
CXXTemporaryObjectExpr *E) {<br>
- TypeSourceInfo *T =<br>
- getDerived().<wbr>TransformTypeWithDeducedTST(E-<wbr>>getTypeSourceInfo());<br>
+ TypeSourceInfo *T = getDerived().TransformType(E-><wbr>getTypeSourceInfo());<br>
if (!T)<br>
return ExprError();<br>
<br>
@@ -10759,8 +10672,7 @@ template<typename Derived><br>
ExprResult<br>
TreeTransform<Derived>::<wbr>TransformCXXUnresolvedConstruc<wbr>tExpr(<br>
CXXUnresolvedConstructExpr *E) {<br>
- TypeSourceInfo *T =<br>
- getDerived().<wbr>TransformTypeWithDeducedTST(E-<wbr>>getTypeSourceInfo());<br>
+ TypeSourceInfo *T = getDerived().TransformType(E-><wbr>getTypeSourceInfo());<br>
if (!T)<br>
return ExprError();<br>
<br>
<br>
Modified: cfe/trunk/test/Parser/cxx1z-<wbr>class-template-argument-<wbr>deduction.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Parser/cxx1z-class-template-argument-deduction.cpp?rev=293473&r1=293472&r2=293473&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/cfe/trunk/test/Parser/<wbr>cxx1z-class-template-argument-<wbr>deduction.cpp?rev=293473&r1=<wbr>293472&r2=293473&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- cfe/trunk/test/Parser/cxx1z-<wbr>class-template-argument-<wbr>deduction.cpp (original)<br>
+++ cfe/trunk/test/Parser/cxx1z-<wbr>class-template-argument-<wbr>deduction.cpp Mon Jan 30 04:44:11 2017<br>
@@ -1,6 +1,6 @@<br>
// RUN: %clang_cc1 -std=c++1z -fcxx-exceptions -verify %s<br>
<br>
-template<typename T> struct A {}; // expected-note 35{{declared here}}<br>
+template<typename T> struct A {}; // expected-note 31{{declared here}}<br>
<br>
// Make sure we still correctly parse cases where a template can appear without arguments.<br>
namespace template_template_arg {<br>
@@ -101,8 +101,6 @@ namespace expr {<br>
(void)reinterpret_cast<A*>(&n)<wbr>; // expected-error{{requires template arguments; argument deduction not allowed here}}<br>
(void)const_cast<A>(n); // expected-error{{requires template arguments; argument deduction not allowed here}}<br>
(void)*(A*)(&n); // expected-error{{requires template arguments; argument deduction not allowed here}}<br>
- (void)(A)(n); // expected-error{{requires template arguments; argument deduction not allowed here}}<br>
- (void)(A){n}; // expected-error{{requires template arguments; argument deduction not allowed here}}<br>
<br>
(void)A(n); // expected-error {{not yet supported}}<br>
(void)A{n}; // expected-error {{not yet supported}}<br>
@@ -123,7 +121,6 @@ namespace decl {<br>
<br>
A a; // expected-error {{requires an initializer}}<br>
A b = 0; // expected-error {{not yet supported}}<br>
- const A c = 0; // expected-error {{not yet supported}}<br>
A (parens) = 0; // expected-error {{cannot use parentheses when declaring variable with deduced class template specialization type}}<br>
A *p = 0; // expected-error {{cannot form pointer to deduced class template specialization type}}<br>
A &r = *p; // expected-error {{cannot form reference to deduced class template specialization type}}<br>
@@ -132,57 +129,3 @@ namespace decl {<br>
A (*fp)() = 0; // expected-error {{cannot form function returning deduced class template specialization type}}<br>
A [x, y] = 0; // expected-error {{cannot be declared with type 'A'}} expected-error {{not yet supported}}<br>
}<br>
-<br>
-namespace typename_specifier {<br>
- struct F {};<br>
-<br>
- void e() {<br>
- (void) typename ::A(0); // expected-error {{not yet supported}}<br>
- (void) typename ::A{0}; // expected-error {{not yet supported}}<br>
- new typename ::A(0); // expected-error {{not yet supported}}<br>
- new typename ::A{0}; // expected-error {{not yet supported}}<br>
- typename ::A a = 0; // expected-error {{not yet supported}}<br>
- const typename ::A b = 0; // expected-error {{not yet supported}}<br>
- if (typename ::A a = 0) {} // expected-error {{not yet supported}}<br>
- for (typename ::A a = 0; typename ::A b = 0; /**/) {} // expected-error 2{{not yet supported}}<br>
-<br>
- (void)(typename ::A)(0); // expected-error{{requires template arguments; argument deduction not allowed here}}<br>
- (void)(typename ::A){0}; // expected-error{{requires template arguments; argument deduction not allowed here}}<br>
- }<br>
- typename ::A a = 0; // expected-error {{not yet supported}}<br>
- const typename ::A b = 0; // expected-error {{not yet supported}}<br>
- typename ::A (parens) = 0; // expected-error {{cannot use parentheses when declaring variable with deduced class template specialization type}}<br>
- typename ::A *p = 0; // expected-error {{cannot form pointer to deduced class template specialization type}}<br>
- typename ::A &r = *p; // expected-error {{cannot form reference to deduced class template specialization type}}<br>
- typename ::A arr[3] = 0; // expected-error {{cannot form array of deduced class template specialization type}}<br>
- typename ::A F::*pm = 0; // expected-error {{cannot form pointer to deduced class template specialization type}}<br>
- typename ::A (*fp)() = 0; // expected-error {{cannot form function returning deduced class template specialization type}}<br>
- typename ::A [x, y] = 0; // expected-error {{cannot be declared with type 'typename ::A'}} expected-error {{not yet supported}}<br>
-<br>
- struct X { template<typename T> struct A {}; }; // expected-note 8{{template}}<br>
-<br>
- template<typename T> void f() {<br>
- (void) typename T::A(0); // expected-error {{not yet supported}}<br>
- (void) typename T::A{0}; // expected-error {{not yet supported}}<br>
- new typename T::A(0); // expected-error {{not yet supported}}<br>
- new typename T::A{0}; // expected-error {{not yet supported}}<br>
- typename T::A a = 0; // expected-error {{not yet supported}}<br>
- const typename T::A b = 0; // expected-error {{not yet supported}}<br>
- if (typename T::A a = 0) {} // expected-error {{not yet supported}}<br>
- for (typename T::A a = 0; typename T::A b = 0; /**/) {} // expected-error 2{{not yet supported}}<br>
-<br>
- {(void)(typename T::A)(0);} // expected-error{{refers to class template member}}<br>
- {(void)(typename T::A){0};} // expected-error{{refers to class template member}}<br>
- {typename T::A (parens) = 0;} // expected-error {{refers to class template member in 'typename_specifier::X'; argument deduction not allowed here}}<br>
- {typename T::A *p = 0;} // expected-error {{refers to class template member}}<br>
- {typename T::A &r = *p;} // expected-error {{refers to class template member}}<br>
- {typename T::A arr[3] = 0;} // expected-error {{refers to class template member}}<br>
- {typename T::A F::*pm = 0;} // expected-error {{refers to class template member}}<br>
- {typename T::A (*fp)() = 0;} // expected-error {{refers to class template member}}<br>
- {typename T::A [x, y] = 0;} // expected-error {{cannot be declared with type 'typename T::A'}} expected-error {{not yet supported}}<br>
- }<br>
- template void f<X>(); // expected-note {{instantiation of}}<br>
-<br>
- template<typename T> void g(typename T::A = 0); // expected-note {{refers to class template member}}<br>
- void h() { g<X>(); } // expected-error {{no matching function}}<br>
-}<br>
<br>
Modified: cfe/trunk/test/SemaCXX/cxx0x-<wbr>class.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/cxx0x-class.cpp?rev=293473&r1=293472&r2=293473&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/cfe/trunk/test/<wbr>SemaCXX/cxx0x-class.cpp?rev=<wbr>293473&r1=293472&r2=293473&<wbr>view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- cfe/trunk/test/SemaCXX/cxx0x-<wbr>class.cpp (original)<br>
+++ cfe/trunk/test/SemaCXX/cxx0x-<wbr>class.cpp Mon Jan 30 04:44:11 2017<br>
@@ -45,3 +45,11 @@ class DefaultMemberInitSelf {<br>
DefaultMemberTemplate<int> t = {};<br>
int *p = &t.n;<br>
};<br>
+<br>
+namespace composed_templates {<br>
+ // Regression test -- obtaining the type from composed templates should not<br>
+ // require out-of-line definition.<br>
+ template <typename T> struct Zero { static const typename T::type value = 0; };<br>
+ struct Integer { using type = int; };<br>
+ template struct Zero<Integer>;<br>
+}<br>
<br>
<br>
______________________________<wbr>_________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@lists.llvm.org">cfe-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/cfe-commits</a><br>
</blockquote></div><br></div>