From 9ab14541716928894821cf5d53d6b4c95ffdf3a3 Mon Sep 17 00:00:00 2001 From: Jeffrey Yasskin Date: Thu, 8 Apr 2010 16:38:48 +0000 Subject: [PATCH] Make CXXScopeSpec invalid when incomplete, and propagate that into any Declarator that depends on it. This fixes several redundant errors and bad recoveries. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100779 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/clang/Parse/Action.h | 44 ++++++------- include/clang/Parse/Parser.h | 2 +- lib/Frontend/PrintParserCallbacks.cpp | 2 +- lib/Parse/MinimalAction.cpp | 8 +-- lib/Parse/ParseDecl.cpp | 15 +++-- lib/Parse/ParseDeclCXX.cpp | 2 +- lib/Sema/Sema.h | 65 ++++++++++--------- lib/Sema/SemaCXXScopeSpec.cpp | 23 ++++--- lib/Sema/SemaCodeComplete.cpp | 2 +- lib/Sema/SemaDecl.cpp | 6 +- lib/Sema/SemaDeclCXX.cpp | 10 +-- lib/Sema/SemaExpr.cpp | 14 ++-- lib/Sema/SemaExprCXX.cpp | 4 +- lib/Sema/SemaLookup.cpp | 4 +- lib/Sema/SemaTemplate.cpp | 14 ++-- test/CXX/temp/temp.spec/temp.explicit/p3.cpp | 16 ++--- test/SemaCXX/nested-name-spec.cpp | 8 +-- .../instantiate-function-params.cpp | 3 +- test/SemaTemplate/instantiate-typedef.cpp | 3 +- test/SemaTemplate/typename-specifier.cpp | 15 ++--- 20 files changed, 127 insertions(+), 133 deletions(-) diff --git a/include/clang/Parse/Action.h b/include/clang/Parse/Action.h index e8901b85d1..4e4a1141ab 100644 --- a/include/clang/Parse/Action.h +++ b/include/clang/Parse/Action.h @@ -205,7 +205,7 @@ public: /// \returns the type referred to by this identifier, or NULL if the type /// does not name an identifier. virtual TypeTy *getTypeName(IdentifierInfo &II, SourceLocation NameLoc, - Scope *S, const CXXScopeSpec *SS = 0, + Scope *S, CXXScopeSpec *SS = 0, bool isClassName = false, TypeTy *ObjectType = 0) = 0; @@ -243,7 +243,7 @@ public: virtual bool DiagnoseUnknownTypeName(const IdentifierInfo &II, SourceLocation IILoc, Scope *S, - const CXXScopeSpec *SS, + CXXScopeSpec *SS, TypeTy *&SuggestedType) { return false; } @@ -281,7 +281,7 @@ public: /// /// \returns the kind of template that this name refers to. virtual TemplateNameKind isTemplateName(Scope *S, - const CXXScopeSpec &SS, + CXXScopeSpec &SS, UnqualifiedId &Name, TypeTy *ObjectType, bool EnteringContext, @@ -329,7 +329,7 @@ public: /// This actual is used in the parsing of pseudo-destructor names to /// distinguish a nested-name-specifier and a "type-name ::" when we /// see the token sequence "X :: ~". - virtual bool isNonTypeNestedNameSpecifier(Scope *S, const CXXScopeSpec &SS, + virtual bool isNonTypeNestedNameSpecifier(Scope *S, CXXScopeSpec &SS, SourceLocation IdLoc, IdentifierInfo &II, TypeTy *ObjectType) { @@ -371,7 +371,7 @@ public: /// /// \returns a CXXScopeTy* object representing the C++ scope. virtual CXXScopeTy *ActOnCXXNestedNameSpecifier(Scope *S, - const CXXScopeSpec &SS, + CXXScopeSpec &SS, SourceLocation IdLoc, SourceLocation CCLoc, IdentifierInfo &II, @@ -387,7 +387,7 @@ public: /// /// The arguments are the same as those passed to ActOnCXXNestedNameSpecifier. virtual bool IsInvalidUnlessNestedName(Scope *S, - const CXXScopeSpec &SS, + CXXScopeSpec &SS, IdentifierInfo &II, TypeTy *ObjectType, bool EnteringContext) { @@ -428,7 +428,7 @@ public: /// ActOnCXXExitDeclaratorScope is called. /// The 'SS' should be a non-empty valid CXXScopeSpec. /// \returns true if an error occurred, false otherwise. - virtual bool ActOnCXXEnterDeclaratorScope(Scope *S, const CXXScopeSpec &SS) { + virtual bool ActOnCXXEnterDeclaratorScope(Scope *S, CXXScopeSpec &SS) { return false; } @@ -655,7 +655,7 @@ public: /// /// \returns the declaration to which this tag refers. virtual DeclPtrTy ActOnTag(Scope *S, unsigned TagSpec, TagUseKind TUK, - SourceLocation KWLoc, const CXXScopeSpec &SS, + SourceLocation KWLoc, CXXScopeSpec &SS, IdentifierInfo *Name, SourceLocation NameLoc, AttributeList *Attr, AccessSpecifier AS, MultiTemplateParamsArg TemplateParameterLists, @@ -1049,7 +1049,7 @@ public: /// id-expression or identifier was an ampersand ('&'), indicating that /// we will be taking the address of this expression. virtual OwningExprResult ActOnIdExpression(Scope *S, - const CXXScopeSpec &SS, + CXXScopeSpec &SS, UnqualifiedId &Name, bool HasTrailingLParen, bool IsAddressOfOperand) { @@ -1127,7 +1127,7 @@ public: virtual OwningExprResult ActOnMemberAccessExpr(Scope *S, ExprArg Base, SourceLocation OpLoc, tok::TokenKind OpKind, - const CXXScopeSpec &SS, + CXXScopeSpec &SS, UnqualifiedId &Member, DeclPtrTy ObjCImpDecl, bool HasTrailingLParen) { @@ -1315,7 +1315,7 @@ public: virtual DeclPtrTy ActOnUsingDirective(Scope *CurScope, SourceLocation UsingLoc, SourceLocation NamespcLoc, - const CXXScopeSpec &SS, + CXXScopeSpec &SS, SourceLocation IdentLoc, IdentifierInfo *NamespcName, AttributeList *AttrList); @@ -1326,7 +1326,7 @@ public: SourceLocation NamespaceLoc, SourceLocation AliasLoc, IdentifierInfo *Alias, - const CXXScopeSpec &SS, + CXXScopeSpec &SS, SourceLocation IdentLoc, IdentifierInfo *Ident) { return DeclPtrTy(); @@ -1372,7 +1372,7 @@ public: AccessSpecifier AS, bool HasUsingKeyword, SourceLocation UsingLoc, - const CXXScopeSpec &SS, + CXXScopeSpec &SS, UnqualifiedId &Name, AttributeList *AttrList, bool IsTypeName, @@ -1501,7 +1501,7 @@ public: /// \returns the type being destructed. virtual TypeTy *getDestructorName(SourceLocation TildeLoc, IdentifierInfo &II, SourceLocation NameLoc, - Scope *S, const CXXScopeSpec &SS, + Scope *S, CXXScopeSpec &SS, TypeTy *ObjectType, bool EnteringContext) { return getTypeName(II, NameLoc, S, &SS, false, ObjectType); @@ -1683,7 +1683,7 @@ public: virtual OwningExprResult ActOnPseudoDestructorExpr(Scope *S, ExprArg Base, SourceLocation OpLoc, tok::TokenKind OpKind, - const CXXScopeSpec &SS, + CXXScopeSpec &SS, UnqualifiedId &FirstTypeName, SourceLocation CCLoc, SourceLocation TildeLoc, @@ -1729,7 +1729,7 @@ public: virtual MemInitResult ActOnMemInitializer(DeclPtrTy ConstructorDecl, Scope *S, - const CXXScopeSpec &SS, + CXXScopeSpec &SS, IdentifierInfo *MemberOrBase, TypeTy *TemplateTypeTy, SourceLocation IdLoc, @@ -1939,7 +1939,7 @@ public: /// \param EnteringContext whether we are entering the context of this /// template. virtual TemplateTy ActOnDependentTemplateName(SourceLocation TemplateKWLoc, - const CXXScopeSpec &SS, + CXXScopeSpec &SS, UnqualifiedId &Name, TypeTy *ObjectType, bool EnteringContext) { @@ -1995,7 +1995,7 @@ public: virtual DeclResult ActOnClassTemplateSpecialization(Scope *S, unsigned TagSpec, TagUseKind TUK, SourceLocation KWLoc, - const CXXScopeSpec &SS, + CXXScopeSpec &SS, TemplateTy Template, SourceLocation TemplateNameLoc, SourceLocation LAngleLoc, @@ -2133,7 +2133,7 @@ public: SourceLocation TemplateLoc, unsigned TagSpec, SourceLocation KWLoc, - const CXXScopeSpec &SS, + CXXScopeSpec &SS, IdentifierInfo *Name, SourceLocation NameLoc, AttributeList *Attr) { @@ -2581,7 +2581,7 @@ public: /// /// \parame EnteringContext whether we're entering the context of this /// scope specifier. - virtual void CodeCompleteQualifiedId(Scope *S, const CXXScopeSpec &SS, + virtual void CodeCompleteQualifiedId(Scope *S, CXXScopeSpec &SS, bool EnteringContext) { } /// \brief Code completion for a C++ "using" declaration or directive. @@ -2863,7 +2863,7 @@ public: /// \returns the type referred to by this identifier, or NULL if the type /// does not name an identifier. virtual TypeTy *getTypeName(IdentifierInfo &II, SourceLocation NameLoc, - Scope *S, const CXXScopeSpec *SS, + Scope *S, CXXScopeSpec *SS, bool isClassName = false, TypeTy *ObjectType = 0); @@ -2873,7 +2873,7 @@ public: const CXXScopeSpec *SS); virtual TemplateNameKind isTemplateName(Scope *S, - const CXXScopeSpec &SS, + CXXScopeSpec &SS, UnqualifiedId &Name, TypeTy *ObjectType, bool EnteringContext, diff --git a/include/clang/Parse/Parser.h b/include/clang/Parse/Parser.h index 9a4634a420..191ca61a91 100644 --- a/include/clang/Parse/Parser.h +++ b/include/clang/Parse/Parser.h @@ -1354,7 +1354,7 @@ private: //===--------------------------------------------------------------------===// // C++ 9: classes [class] and C structs/unions. TypeResult ParseClassName(SourceLocation &EndLocation, - const CXXScopeSpec *SS = 0); + CXXScopeSpec *SS = 0); void ParseClassSpecifier(tok::TokenKind TagTokKind, SourceLocation TagLoc, DeclSpec &DS, const ParsedTemplateInfo &TemplateInfo = ParsedTemplateInfo(), diff --git a/lib/Frontend/PrintParserCallbacks.cpp b/lib/Frontend/PrintParserCallbacks.cpp index 8d64a64133..9d4600ff54 100644 --- a/lib/Frontend/PrintParserCallbacks.cpp +++ b/lib/Frontend/PrintParserCallbacks.cpp @@ -197,7 +197,7 @@ namespace { } virtual DeclPtrTy ActOnTag(Scope *S, unsigned TagSpec, TagUseKind TUK, - SourceLocation KWLoc, const CXXScopeSpec &SS, + SourceLocation KWLoc, CXXScopeSpec &SS, IdentifierInfo *Name, SourceLocation NameLoc, AttributeList *Attr, AccessSpecifier AS, MultiTemplateParamsArg TemplateParameterLists, diff --git a/lib/Parse/MinimalAction.cpp b/lib/Parse/MinimalAction.cpp index 5f48897235..e75569231c 100644 --- a/lib/Parse/MinimalAction.cpp +++ b/lib/Parse/MinimalAction.cpp @@ -30,7 +30,7 @@ Action::~Action() {} Action::DeclPtrTy Action::ActOnUsingDirective(Scope *CurScope, SourceLocation UsingLoc, SourceLocation NamespcLoc, - const CXXScopeSpec &SS, + CXXScopeSpec &SS, SourceLocation IdentLoc, IdentifierInfo *NamespcName, AttributeList *AttrList) { @@ -47,7 +47,7 @@ Action::DeclPtrTy Action::ActOnUsingDeclaration(Scope *CurScope, AccessSpecifier AS, bool HasUsingKeyword, SourceLocation UsingLoc, - const CXXScopeSpec &SS, + CXXScopeSpec &SS, UnqualifiedId &Name, AttributeList *AttrList, bool IsTypeName, @@ -144,7 +144,7 @@ void MinimalAction::ActOnTranslationUnitScope(SourceLocation Loc, Scope *S) { /// FIXME: Use the passed CXXScopeSpec for accurate C++ type checking. Action::TypeTy * MinimalAction::getTypeName(IdentifierInfo &II, SourceLocation Loc, - Scope *S, const CXXScopeSpec *SS, + Scope *S, CXXScopeSpec *SS, bool isClassName, TypeTy *ObjectType) { if (TypeNameInfo *TI = II.getFETokenInfo()) if (TI->isTypeName) @@ -161,7 +161,7 @@ bool MinimalAction::isCurrentClassName(const IdentifierInfo &, Scope *, TemplateNameKind MinimalAction::isTemplateName(Scope *S, - const CXXScopeSpec &SS, + CXXScopeSpec &SS, UnqualifiedId &Name, TypeTy *ObjectType, bool EnteringScope, diff --git a/lib/Parse/ParseDecl.cpp b/lib/Parse/ParseDecl.cpp index 73a5704878..da4a002844 100644 --- a/lib/Parse/ParseDecl.cpp +++ b/lib/Parse/ParseDecl.cpp @@ -2583,20 +2583,18 @@ void Parser::ParseDirectDeclarator(Declarator &D) { if (getLang().CPlusPlus && D.mayHaveIdentifier()) { // ParseDeclaratorInternal might already have parsed the scope. - bool afterCXXScope = D.getCXXScopeSpec().isSet(); - if (!afterCXXScope) { + if (D.getCXXScopeSpec().isEmpty()) { ParseOptionalCXXScopeSpecifier(D.getCXXScopeSpec(), /*ObjectType=*/0, true); - afterCXXScope = D.getCXXScopeSpec().isSet(); } - if (afterCXXScope) { + if (D.getCXXScopeSpec().isValid()) { if (Actions.ShouldEnterDeclaratorScope(CurScope, D.getCXXScopeSpec())) // Change the declaration context for name lookup, until this function // is exited (and the declarator has been parsed). DeclScopeObj.EnterDeclaratorScope(); - } - + } + if (Tok.is(tok::identifier) || Tok.is(tok::kw_operator) || Tok.is(tok::annot_template_id) || Tok.is(tok::tilde)) { // We found something that indicates the start of an unqualified-id. @@ -2612,7 +2610,10 @@ void Parser::ParseDirectDeclarator(Declarator &D) { /*AllowDestructorName=*/true, AllowConstructorName, /*ObjectType=*/0, - D.getName())) { + D.getName()) || + // Once we're past the identifier, if the scope was bad, mark the + // whole declarator bad. + D.getCXXScopeSpec().isInvalid()) { D.SetIdentifier(0, Tok.getLocation()); D.setInvalidType(true); } else { diff --git a/lib/Parse/ParseDeclCXX.cpp b/lib/Parse/ParseDeclCXX.cpp index 813c24ce3d..c6df57193b 100644 --- a/lib/Parse/ParseDeclCXX.cpp +++ b/lib/Parse/ParseDeclCXX.cpp @@ -465,7 +465,7 @@ void Parser::ParseDecltypeSpecifier(DeclSpec &DS) { /// simple-template-id /// Parser::TypeResult Parser::ParseClassName(SourceLocation &EndLocation, - const CXXScopeSpec *SS) { + CXXScopeSpec *SS) { // Check whether we have a template-id that names a type. if (Tok.is(tok::annot_template_id)) { TemplateIdAnnotation *TemplateId diff --git a/lib/Sema/Sema.h b/lib/Sema/Sema.h index dc669a9ad5..65c5793be8 100644 --- a/lib/Sema/Sema.h +++ b/lib/Sema/Sema.h @@ -758,14 +758,14 @@ public: DeclGroupPtrTy ConvertDeclToDeclGroup(DeclPtrTy Ptr); virtual TypeTy *getTypeName(IdentifierInfo &II, SourceLocation NameLoc, - Scope *S, const CXXScopeSpec *SS, + Scope *S, CXXScopeSpec *SS, bool isClassName = false, TypeTy *ObjectType = 0); virtual DeclSpec::TST isTagName(IdentifierInfo &II, Scope *S); virtual bool DiagnoseUnknownTypeName(const IdentifierInfo &II, SourceLocation IILoc, Scope *S, - const CXXScopeSpec *SS, + CXXScopeSpec *SS, TypeTy *&SuggestedType); virtual DeclPtrTy ActOnDeclarator(Scope *S, Declarator &D) { @@ -877,7 +877,7 @@ public: const IdentifierInfo &Name); virtual DeclPtrTy ActOnTag(Scope *S, unsigned TagSpec, TagUseKind TUK, - SourceLocation KWLoc, const CXXScopeSpec &SS, + SourceLocation KWLoc, CXXScopeSpec &SS, IdentifierInfo *Name, SourceLocation NameLoc, AttributeList *Attr, AccessSpecifier AS, MultiTemplateParamsArg TemplateParameterLists, @@ -1407,7 +1407,7 @@ public: bool AllowBuiltinCreation = false); bool LookupQualifiedName(LookupResult &R, DeclContext *LookupCtx, bool InUnqualifiedLookup = false); - bool LookupParsedName(LookupResult &R, Scope *S, const CXXScopeSpec *SS, + bool LookupParsedName(LookupResult &R, Scope *S, CXXScopeSpec *SS, bool AllowBuiltinCreation = false, bool EnteringContext = false); ObjCProtocolDecl *LookupProtocol(IdentifierInfo *II); @@ -1425,7 +1425,7 @@ public: void LookupVisibleDecls(DeclContext *Ctx, LookupNameKind Kind, VisibleDeclConsumer &Consumer); - bool CorrectTypo(LookupResult &R, Scope *S, const CXXScopeSpec *SS, + bool CorrectTypo(LookupResult &R, Scope *S, CXXScopeSpec *SS, DeclContext *MemberContext = 0, bool EnteringContext = false, const ObjCObjectPointerType *OPT = 0); @@ -1719,12 +1719,12 @@ public: virtual SourceRange getExprRange(ExprTy *E) const; virtual OwningExprResult ActOnIdExpression(Scope *S, - const CXXScopeSpec &SS, + CXXScopeSpec &SS, UnqualifiedId &Name, bool HasTrailingLParen, bool IsAddressOfOperand); - bool DiagnoseEmptyLookup(Scope *S, const CXXScopeSpec &SS, LookupResult &R); + bool DiagnoseEmptyLookup(Scope *S, CXXScopeSpec &SS, LookupResult &R); OwningExprResult LookupInObjCMethod(LookupResult &R, Scope *S, @@ -1758,7 +1758,7 @@ public: const LookupResult &R, bool HasTrailingLParen); - OwningExprResult BuildQualifiedDeclarationNameExpr(const CXXScopeSpec &SS, + OwningExprResult BuildQualifiedDeclarationNameExpr(CXXScopeSpec &SS, DeclarationName Name, SourceLocation NameLoc); OwningExprResult BuildDependentDeclRefExpr(const CXXScopeSpec &SS, @@ -1828,7 +1828,7 @@ public: QualType BaseType, SourceLocation OpLoc, bool IsArrow, - const CXXScopeSpec &SS, + CXXScopeSpec &SS, NamedDecl *FirstQualifierInScope, DeclarationName Name, SourceLocation NameLoc, @@ -1844,7 +1844,7 @@ public: OwningExprResult LookupMemberExpr(LookupResult &R, Expr *&Base, bool &IsArrow, SourceLocation OpLoc, - const CXXScopeSpec &SS, + CXXScopeSpec &SS, DeclPtrTy ObjCImpDecl); bool CheckQualifiedMemberReference(Expr *BaseExpr, QualType BaseType, @@ -1864,7 +1864,7 @@ public: virtual OwningExprResult ActOnMemberAccessExpr(Scope *S, ExprArg Base, SourceLocation OpLoc, tok::TokenKind OpKind, - const CXXScopeSpec &SS, + CXXScopeSpec &SS, UnqualifiedId &Member, DeclPtrTy ObjCImpDecl, bool HasTrailingLParen); @@ -2008,7 +2008,7 @@ public: virtual DeclPtrTy ActOnUsingDirective(Scope *CurScope, SourceLocation UsingLoc, SourceLocation NamespcLoc, - const CXXScopeSpec &SS, + CXXScopeSpec &SS, SourceLocation IdentLoc, IdentifierInfo *NamespcName, AttributeList *AttrList); @@ -2019,7 +2019,7 @@ public: SourceLocation NamespaceLoc, SourceLocation AliasLoc, IdentifierInfo *Alias, - const CXXScopeSpec &SS, + CXXScopeSpec &SS, SourceLocation IdentLoc, IdentifierInfo *Ident); @@ -2040,7 +2040,7 @@ public: NamedDecl *BuildUsingDeclaration(Scope *S, AccessSpecifier AS, SourceLocation UsingLoc, - const CXXScopeSpec &SS, + CXXScopeSpec &SS, SourceLocation IdentLoc, DeclarationName Name, AttributeList *AttrList, @@ -2052,7 +2052,7 @@ public: AccessSpecifier AS, bool HasUsingKeyword, SourceLocation UsingLoc, - const CXXScopeSpec &SS, + CXXScopeSpec &SS, UnqualifiedId &Name, AttributeList *AttrList, bool IsTypeName, @@ -2153,7 +2153,7 @@ public: virtual TypeTy *getDestructorName(SourceLocation TildeLoc, IdentifierInfo &II, SourceLocation NameLoc, - Scope *S, const CXXScopeSpec &SS, + Scope *S, CXXScopeSpec &SS, TypeTy *ObjectType, bool EnteringContext); @@ -2287,7 +2287,7 @@ public: virtual OwningExprResult ActOnPseudoDestructorExpr(Scope *S, ExprArg Base, SourceLocation OpLoc, tok::TokenKind OpKind, - const CXXScopeSpec &SS, + CXXScopeSpec &SS, UnqualifiedId &FirstTypeName, SourceLocation CCLoc, SourceLocation TildeLoc, @@ -2303,7 +2303,8 @@ public: virtual OwningExprResult ActOnFinishFullExpr(ExprArg Expr); - bool RequireCompleteDeclContext(const CXXScopeSpec &SS); + // Marks SS invalid if it represents an incomplete type. + bool RequireCompleteDeclContext(CXXScopeSpec &SS); DeclContext *computeDeclContext(QualType T); DeclContext *computeDeclContext(const CXXScopeSpec &SS, @@ -2320,13 +2321,13 @@ public: bool isAcceptableNestedNameSpecifier(NamedDecl *SD); NamedDecl *FindFirstQualifierInScope(Scope *S, NestedNameSpecifier *NNS); - virtual bool isNonTypeNestedNameSpecifier(Scope *S, const CXXScopeSpec &SS, + virtual bool isNonTypeNestedNameSpecifier(Scope *S, CXXScopeSpec &SS, SourceLocation IdLoc, IdentifierInfo &II, TypeTy *ObjectType); CXXScopeTy *BuildCXXNestedNameSpecifier(Scope *S, - const CXXScopeSpec &SS, + CXXScopeSpec &SS, SourceLocation IdLoc, SourceLocation CCLoc, IdentifierInfo &II, @@ -2336,7 +2337,7 @@ public: bool ErrorRecoveryLookup); virtual CXXScopeTy *ActOnCXXNestedNameSpecifier(Scope *S, - const CXXScopeSpec &SS, + CXXScopeSpec &SS, SourceLocation IdLoc, SourceLocation CCLoc, IdentifierInfo &II, @@ -2344,7 +2345,7 @@ public: bool EnteringContext); virtual bool IsInvalidUnlessNestedName(Scope *S, - const CXXScopeSpec &SS, + CXXScopeSpec &SS, IdentifierInfo &II, TypeTy *ObjectType, bool EnteringContext); @@ -2371,7 +2372,7 @@ public: /// looked up in the declarator-id's scope, until the declarator is parsed and /// ActOnCXXExitDeclaratorScope is called. /// The 'SS' should be a non-empty valid CXXScopeSpec. - virtual bool ActOnCXXEnterDeclaratorScope(Scope *S, const CXXScopeSpec &SS); + virtual bool ActOnCXXEnterDeclaratorScope(Scope *S, CXXScopeSpec &SS); /// ActOnCXXExitDeclaratorScope - Called when a declarator that previously /// invoked ActOnCXXEnterDeclaratorScope(), is finished. 'SS' is the same @@ -2452,7 +2453,7 @@ public: virtual MemInitResult ActOnMemInitializer(DeclPtrTy ConstructorD, Scope *S, - const CXXScopeSpec &SS, + CXXScopeSpec &SS, IdentifierInfo *MemberOrBase, TypeTy *TemplateTypeTy, SourceLocation IdLoc, @@ -2690,11 +2691,11 @@ public: //===--------------------------------------------------------------------===// // C++ Templates [C++ 14] // - void LookupTemplateName(LookupResult &R, Scope *S, const CXXScopeSpec &SS, + void LookupTemplateName(LookupResult &R, Scope *S, CXXScopeSpec &SS, QualType ObjectType, bool EnteringContext); virtual TemplateNameKind isTemplateName(Scope *S, - const CXXScopeSpec &SS, + CXXScopeSpec &SS, UnqualifiedId &Name, TypeTy *ObjectType, bool EnteringContext, @@ -2767,7 +2768,7 @@ public: bool &IsExplicitSpecialization); DeclResult CheckClassTemplate(Scope *S, unsigned TagSpec, TagUseKind TUK, - SourceLocation KWLoc, const CXXScopeSpec &SS, + SourceLocation KWLoc, CXXScopeSpec &SS, IdentifierInfo *Name, SourceLocation NameLoc, AttributeList *Attr, TemplateParameterList *TemplateParams, @@ -2795,13 +2796,13 @@ public: LookupResult &R, bool RequiresADL, const TemplateArgumentListInfo &TemplateArgs); - OwningExprResult BuildQualifiedTemplateIdExpr(const CXXScopeSpec &SS, + OwningExprResult BuildQualifiedTemplateIdExpr(CXXScopeSpec &SS, DeclarationName Name, SourceLocation NameLoc, const TemplateArgumentListInfo &TemplateArgs); virtual TemplateTy ActOnDependentTemplateName(SourceLocation TemplateKWLoc, - const CXXScopeSpec &SS, + CXXScopeSpec &SS, UnqualifiedId &Name, TypeTy *ObjectType, bool EnteringContext); @@ -2814,7 +2815,7 @@ public: virtual DeclResult ActOnClassTemplateSpecialization(Scope *S, unsigned TagSpec, TagUseKind TUK, SourceLocation KWLoc, - const CXXScopeSpec &SS, + CXXScopeSpec &SS, TemplateTy Template, SourceLocation TemplateNameLoc, SourceLocation LAngleLoc, @@ -2868,7 +2869,7 @@ public: SourceLocation TemplateLoc, unsigned TagSpec, SourceLocation KWLoc, - const CXXScopeSpec &SS, + CXXScopeSpec &SS, IdentifierInfo *Name, SourceLocation NameLoc, AttributeList *Attr); @@ -4265,7 +4266,7 @@ public: virtual void CodeCompleteCase(Scope *S); virtual void CodeCompleteCall(Scope *S, ExprTy *Fn, ExprTy **Args, unsigned NumArgs); - virtual void CodeCompleteQualifiedId(Scope *S, const CXXScopeSpec &SS, + virtual void CodeCompleteQualifiedId(Scope *S, CXXScopeSpec &SS, bool EnteringContext); virtual void CodeCompleteUsing(Scope *S); virtual void CodeCompleteUsingDirective(Scope *S); diff --git a/lib/Sema/SemaCXXScopeSpec.cpp b/lib/Sema/SemaCXXScopeSpec.cpp index c90f75eef5..81b3e3116a 100644 --- a/lib/Sema/SemaCXXScopeSpec.cpp +++ b/lib/Sema/SemaCXXScopeSpec.cpp @@ -230,7 +230,7 @@ CXXRecordDecl *Sema::getCurrentInstantiationOf(NestedNameSpecifier *NNS) { /// that is currently being defined. Or, if we have a type that names /// a class template specialization that is not a complete type, we /// will attempt to instantiate that class template. -bool Sema::RequireCompleteDeclContext(const CXXScopeSpec &SS) { +bool Sema::RequireCompleteDeclContext(CXXScopeSpec &SS) { if (!SS.isSet() || SS.isInvalid()) return false; @@ -247,10 +247,13 @@ bool Sema::RequireCompleteDeclContext(const CXXScopeSpec &SS) { return false; // The type must be complete. - return RequireCompleteType(SS.getRange().getBegin(), - Context.getTypeDeclType(Tag), - PDiag(diag::err_incomplete_nested_name_spec) - << SS.getRange()); + if (RequireCompleteType(SS.getRange().getBegin(), + Context.getTypeDeclType(Tag), + PDiag(diag::err_incomplete_nested_name_spec) + << SS.getRange())) { + SS.setScopeRep(0); // Mark the ScopeSpec invalid. + return true; + } } return false; @@ -322,7 +325,7 @@ NamedDecl *Sema::FindFirstQualifierInScope(Scope *S, NestedNameSpecifier *NNS) { return 0; } -bool Sema::isNonTypeNestedNameSpecifier(Scope *S, const CXXScopeSpec &SS, +bool Sema::isNonTypeNestedNameSpecifier(Scope *S, CXXScopeSpec &SS, SourceLocation IdLoc, IdentifierInfo &II, TypeTy *ObjectTypePtr) { @@ -384,7 +387,7 @@ bool Sema::isNonTypeNestedNameSpecifier(Scope *S, const CXXScopeSpec &SS, /// scope if it *knows* that the result is correct. It should not return in a /// dependent context, for example. Sema::CXXScopeTy *Sema::BuildCXXNestedNameSpecifier(Scope *S, - const CXXScopeSpec &SS, + CXXScopeSpec &SS, SourceLocation IdLoc, SourceLocation CCLoc, IdentifierInfo &II, @@ -593,7 +596,7 @@ Sema::CXXScopeTy *Sema::BuildCXXNestedNameSpecifier(Scope *S, /// 'CCLoc' is the location of '::' and 'II' is the identifier for 'bar'. /// Returns a CXXScopeTy* object representing the C++ scope. Sema::CXXScopeTy *Sema::ActOnCXXNestedNameSpecifier(Scope *S, - const CXXScopeSpec &SS, + CXXScopeSpec &SS, SourceLocation IdLoc, SourceLocation CCLoc, IdentifierInfo &II, @@ -611,7 +614,7 @@ Sema::CXXScopeTy *Sema::ActOnCXXNestedNameSpecifier(Scope *S, /// conservatively correct to always return false from this method. /// /// The arguments are the same as those passed to ActOnCXXNestedNameSpecifier. -bool Sema::IsInvalidUnlessNestedName(Scope *S, const CXXScopeSpec &SS, +bool Sema::IsInvalidUnlessNestedName(Scope *S, CXXScopeSpec &SS, IdentifierInfo &II, TypeTy *ObjectType, bool EnteringContext) { return BuildCXXNestedNameSpecifier(S, SS, SourceLocation(), SourceLocation(), @@ -676,7 +679,7 @@ bool Sema::ShouldEnterDeclaratorScope(Scope *S, const CXXScopeSpec &SS) { /// looked up in the declarator-id's scope, until the declarator is parsed and /// ActOnCXXExitDeclaratorScope is called. /// The 'SS' should be a non-empty valid CXXScopeSpec. -bool Sema::ActOnCXXEnterDeclaratorScope(Scope *S, const CXXScopeSpec &SS) { +bool Sema::ActOnCXXEnterDeclaratorScope(Scope *S, CXXScopeSpec &SS) { assert(SS.isSet() && "Parser passed invalid CXXScopeSpec."); if (SS.isInvalid()) return true; diff --git a/lib/Sema/SemaCodeComplete.cpp b/lib/Sema/SemaCodeComplete.cpp index 66b04a25bc..d990591dc2 100644 --- a/lib/Sema/SemaCodeComplete.cpp +++ b/lib/Sema/SemaCodeComplete.cpp @@ -2266,7 +2266,7 @@ void Sema::CodeCompleteCall(Scope *S, ExprTy *FnIn, Results.size()); } -void Sema::CodeCompleteQualifiedId(Scope *S, const CXXScopeSpec &SS, +void Sema::CodeCompleteQualifiedId(Scope *S, CXXScopeSpec &SS, bool EnteringContext) { if (!SS.getScopeRep() || !CodeCompleter) return; diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp index 8df611fcf1..92d2f4b50c 100644 --- a/lib/Sema/SemaDecl.cpp +++ b/lib/Sema/SemaDecl.cpp @@ -61,7 +61,7 @@ Sema::DeclGroupPtrTy Sema::ConvertDeclToDeclGroup(DeclPtrTy Ptr) { /// If name lookup results in an ambiguity, this routine will complain /// and then return NULL. Sema::TypeTy *Sema::getTypeName(IdentifierInfo &II, SourceLocation NameLoc, - Scope *S, const CXXScopeSpec *SS, + Scope *S, CXXScopeSpec *SS, bool isClassName, TypeTy *ObjectTypePtr) { // Determine where we will perform name lookup. @@ -236,7 +236,7 @@ DeclSpec::TST Sema::isTagName(IdentifierInfo &II, Scope *S) { bool Sema::DiagnoseUnknownTypeName(const IdentifierInfo &II, SourceLocation IILoc, Scope *S, - const CXXScopeSpec *SS, + CXXScopeSpec *SS, TypeTy *&SuggestedType) { // We don't have anything to suggest (yet). SuggestedType = 0; @@ -4707,7 +4707,7 @@ bool Sema::isAcceptableTagRedeclaration(const TagDecl *Previous, /// TagSpec indicates what kind of tag this is. TUK indicates whether this is a /// reference/declaration/definition of a tag. Sema::DeclPtrTy Sema::ActOnTag(Scope *S, unsigned TagSpec, TagUseKind TUK, - SourceLocation KWLoc, const CXXScopeSpec &SS, + SourceLocation KWLoc, CXXScopeSpec &SS, IdentifierInfo *Name, SourceLocation NameLoc, AttributeList *Attr, AccessSpecifier AS, MultiTemplateParamsArg TemplateParameterLists, diff --git a/lib/Sema/SemaDeclCXX.cpp b/lib/Sema/SemaDeclCXX.cpp index 7cdeea4160..d3985ef3a8 100644 --- a/lib/Sema/SemaDeclCXX.cpp +++ b/lib/Sema/SemaDeclCXX.cpp @@ -1013,7 +1013,7 @@ static bool FindBaseInitializer(Sema &SemaRef, Sema::MemInitResult Sema::ActOnMemInitializer(DeclPtrTy ConstructorD, Scope *S, - const CXXScopeSpec &SS, + CXXScopeSpec &SS, IdentifierInfo *MemberOrBase, TypeTy *TemplateTypeTy, SourceLocation IdLoc, @@ -3013,7 +3013,7 @@ void Sema::ActOnFinishNamespaceDef(DeclPtrTy D, SourceLocation RBrace) { Sema::DeclPtrTy Sema::ActOnUsingDirective(Scope *S, SourceLocation UsingLoc, SourceLocation NamespcLoc, - const CXXScopeSpec &SS, + CXXScopeSpec &SS, SourceLocation IdentLoc, IdentifierInfo *NamespcName, AttributeList *AttrList) { @@ -3082,7 +3082,7 @@ Sema::DeclPtrTy Sema::ActOnUsingDeclaration(Scope *S, AccessSpecifier AS, bool HasUsingKeyword, SourceLocation UsingLoc, - const CXXScopeSpec &SS, + CXXScopeSpec &SS, UnqualifiedId &Name, AttributeList *AttrList, bool IsTypeName, @@ -3363,7 +3363,7 @@ void Sema::HideUsingShadowDecl(Scope *S, UsingShadowDecl *Shadow) { /// the lookup differently for these declarations. NamedDecl *Sema::BuildUsingDeclaration(Scope *S, AccessSpecifier AS, SourceLocation UsingLoc, - const CXXScopeSpec &SS, + CXXScopeSpec &SS, SourceLocation IdentLoc, DeclarationName Name, AttributeList *AttrList, @@ -3700,7 +3700,7 @@ Sema::DeclPtrTy Sema::ActOnNamespaceAliasDef(Scope *S, SourceLocation NamespaceLoc, SourceLocation AliasLoc, IdentifierInfo *Alias, - const CXXScopeSpec &SS, + CXXScopeSpec &SS, SourceLocation IdentLoc, IdentifierInfo *Ident) { diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp index b78e8b5b67..da0c0a0499 100644 --- a/lib/Sema/SemaExpr.cpp +++ b/lib/Sema/SemaExpr.cpp @@ -895,7 +895,7 @@ static void DiagnoseInstanceReference(Sema &SemaRef, /// Diagnose an empty lookup. /// /// \return false if new lookup candidates were found -bool Sema::DiagnoseEmptyLookup(Scope *S, const CXXScopeSpec &SS, +bool Sema::DiagnoseEmptyLookup(Scope *S, CXXScopeSpec &SS, LookupResult &R) { DeclarationName Name = R.getLookupName(); @@ -1001,7 +1001,7 @@ bool Sema::DiagnoseEmptyLookup(Scope *S, const CXXScopeSpec &SS, } Sema::OwningExprResult Sema::ActOnIdExpression(Scope *S, - const CXXScopeSpec &SS, + CXXScopeSpec &SS, UnqualifiedId &Id, bool HasTrailingLParen, bool isAddressOfOperand) { @@ -1200,7 +1200,7 @@ Sema::BuildPossibleImplicitMemberExpr(const CXXScopeSpec &SS, /// There's a large number of things which don't need to be done along /// this path. Sema::OwningExprResult -Sema::BuildQualifiedDeclarationNameExpr(const CXXScopeSpec &SS, +Sema::BuildQualifiedDeclarationNameExpr(CXXScopeSpec &SS, DeclarationName Name, SourceLocation NameLoc) { DeclContext *DC; @@ -2549,7 +2549,7 @@ bool Sema::CheckQualifiedMemberReference(Expr *BaseExpr, static bool LookupMemberExprInRecord(Sema &SemaRef, LookupResult &R, SourceRange BaseRange, const RecordType *RTy, - SourceLocation OpLoc, const CXXScopeSpec &SS) { + SourceLocation OpLoc, CXXScopeSpec &SS) { RecordDecl *RDecl = RTy->getDecl(); if (SemaRef.RequireCompleteType(OpLoc, QualType(RTy, 0), SemaRef.PDiag(diag::err_typecheck_incomplete_tag) @@ -2606,7 +2606,7 @@ LookupMemberExprInRecord(Sema &SemaRef, LookupResult &R, Sema::OwningExprResult Sema::BuildMemberReferenceExpr(ExprArg BaseArg, QualType BaseType, SourceLocation OpLoc, bool IsArrow, - const CXXScopeSpec &SS, + CXXScopeSpec &SS, NamedDecl *FirstQualifierInScope, DeclarationName Name, SourceLocation NameLoc, const TemplateArgumentListInfo *TemplateArgs) { @@ -2841,7 +2841,7 @@ Sema::BuildMemberReferenceExpr(ExprArg Base, QualType BaseExprType, Sema::OwningExprResult Sema::LookupMemberExpr(LookupResult &R, Expr *&BaseExpr, bool &IsArrow, SourceLocation OpLoc, - const CXXScopeSpec &SS, + CXXScopeSpec &SS, DeclPtrTy ObjCImpDecl) { assert(BaseExpr && "no base expression"); @@ -3279,7 +3279,7 @@ Sema::LookupMemberExpr(LookupResult &R, Expr *&BaseExpr, Sema::OwningExprResult Sema::ActOnMemberAccessExpr(Scope *S, ExprArg BaseArg, SourceLocation OpLoc, tok::TokenKind OpKind, - const CXXScopeSpec &SS, + CXXScopeSpec &SS, UnqualifiedId &Id, DeclPtrTy ObjCImpDecl, bool HasTrailingLParen) { diff --git a/lib/Sema/SemaExprCXX.cpp b/lib/Sema/SemaExprCXX.cpp index f6adb1545d..7efba3ab67 100644 --- a/lib/Sema/SemaExprCXX.cpp +++ b/lib/Sema/SemaExprCXX.cpp @@ -29,7 +29,7 @@ using namespace clang; Action::TypeTy *Sema::getDestructorName(SourceLocation TildeLoc, IdentifierInfo &II, SourceLocation NameLoc, - Scope *S, const CXXScopeSpec &SS, + Scope *S, CXXScopeSpec &SS, TypeTy *ObjectTypePtr, bool EnteringContext) { // Determine where to perform name lookup. @@ -2705,7 +2705,7 @@ Sema::OwningExprResult Sema::BuildPseudoDestructorExpr(ExprArg Base, Sema::OwningExprResult Sema::ActOnPseudoDestructorExpr(Scope *S, ExprArg Base, SourceLocation OpLoc, tok::TokenKind OpKind, - const CXXScopeSpec &SS, + CXXScopeSpec &SS, UnqualifiedId &FirstTypeName, SourceLocation CCLoc, SourceLocation TildeLoc, diff --git a/lib/Sema/SemaLookup.cpp b/lib/Sema/SemaLookup.cpp index a29c4d4528..35fe7f7d0d 100644 --- a/lib/Sema/SemaLookup.cpp +++ b/lib/Sema/SemaLookup.cpp @@ -1291,7 +1291,7 @@ bool Sema::LookupQualifiedName(LookupResult &R, DeclContext *LookupCtx, /// context of the scope-specifier SS (if present). /// /// @returns True if any decls were found (but possibly ambiguous) -bool Sema::LookupParsedName(LookupResult &R, Scope *S, const CXXScopeSpec *SS, +bool Sema::LookupParsedName(LookupResult &R, Scope *S, CXXScopeSpec *SS, bool AllowBuiltinCreation, bool EnteringContext) { if (SS && SS->isInvalid()) { // When the scope specifier is invalid, don't even look for @@ -2500,7 +2500,7 @@ void TypoCorrectionConsumer::FoundDecl(NamedDecl *ND, NamedDecl *Hiding, /// \returns true if the typo was corrected, in which case the \p Res /// structure will contain the results of name lookup for the /// corrected name. Otherwise, returns false. -bool Sema::CorrectTypo(LookupResult &Res, Scope *S, const CXXScopeSpec *SS, +bool Sema::CorrectTypo(LookupResult &Res, Scope *S, CXXScopeSpec *SS, DeclContext *MemberContext, bool EnteringContext, const ObjCObjectPointerType *OPT) { if (Diags.hasFatalErrorOccurred()) diff --git a/lib/Sema/SemaTemplate.cpp b/lib/Sema/SemaTemplate.cpp index 584cc3e871..7fc0cf85e3 100644 --- a/lib/Sema/SemaTemplate.cpp +++ b/lib/Sema/SemaTemplate.cpp @@ -76,7 +76,7 @@ static void FilterAcceptableTemplateNames(ASTContext &C, LookupResult &R) { } TemplateNameKind Sema::isTemplateName(Scope *S, - const CXXScopeSpec &SS, + CXXScopeSpec &SS, UnqualifiedId &Name, TypeTy *ObjectTypePtr, bool EnteringContext, @@ -169,7 +169,7 @@ bool Sema::DiagnoseUnknownTemplateName(const IdentifierInfo &II, } void Sema::LookupTemplateName(LookupResult &Found, - Scope *S, const CXXScopeSpec &SS, + Scope *S, CXXScopeSpec &SS, QualType ObjectType, bool EnteringContext) { // Determine where to perform name lookup @@ -705,7 +705,7 @@ static void SetNestedNameSpecifier(TagDecl *T, const CXXScopeSpec &SS) { Sema::DeclResult Sema::CheckClassTemplate(Scope *S, unsigned TagSpec, TagUseKind TUK, - SourceLocation KWLoc, const CXXScopeSpec &SS, + SourceLocation KWLoc, CXXScopeSpec &SS, IdentifierInfo *Name, SourceLocation NameLoc, AttributeList *Attr, TemplateParameterList *TemplateParams, @@ -1545,7 +1545,7 @@ Sema::OwningExprResult Sema::BuildTemplateIdExpr(const CXXScopeSpec &SS, // We actually only call this from template instantiation. Sema::OwningExprResult -Sema::BuildQualifiedTemplateIdExpr(const CXXScopeSpec &SS, +Sema::BuildQualifiedTemplateIdExpr(CXXScopeSpec &SS, DeclarationName Name, SourceLocation NameLoc, const TemplateArgumentListInfo &TemplateArgs) { @@ -1586,7 +1586,7 @@ Sema::BuildQualifiedTemplateIdExpr(const CXXScopeSpec &SS, /// of the "template" keyword, and "apply" is the \p Name. Sema::TemplateTy Sema::ActOnDependentTemplateName(SourceLocation TemplateKWLoc, - const CXXScopeSpec &SS, + CXXScopeSpec &SS, UnqualifiedId &Name, TypeTy *ObjectType, bool EnteringContext) { @@ -3482,7 +3482,7 @@ Sema::DeclResult Sema::ActOnClassTemplateSpecialization(Scope *S, unsigned TagSpec, TagUseKind TUK, SourceLocation KWLoc, - const CXXScopeSpec &SS, + CXXScopeSpec &SS, TemplateTy TemplateD, SourceLocation TemplateNameLoc, SourceLocation LAngleLoc, @@ -4663,7 +4663,7 @@ Sema::ActOnExplicitInstantiation(Scope *S, SourceLocation TemplateLoc, unsigned TagSpec, SourceLocation KWLoc, - const CXXScopeSpec &SS, + CXXScopeSpec &SS, IdentifierInfo *Name, SourceLocation NameLoc, AttributeList *Attr) { diff --git a/test/CXX/temp/temp.spec/temp.explicit/p3.cpp b/test/CXX/temp/temp.spec/temp.explicit/p3.cpp index e30f046c2b..e9758bcdec 100644 --- a/test/CXX/temp/temp.spec/temp.explicit/p3.cpp +++ b/test/CXX/temp/temp.spec/temp.explicit/p3.cpp @@ -8,12 +8,11 @@ template void f0(int); // okay // A definition of the class or class template containing a member function // template shall be in scope at the point of the explicit instantiation of // the member function template. -struct X0; // expected-note 3{{forward declaration}} -template struct X1; // expected-note 8{{declared here}} +struct X0; // expected-note {{forward declaration}} +template struct X1; // expected-note 5{{declared here}} -// FIXME: Repeated diagnostics here! -template void X0::f0(int); // expected-error 3{{incomplete type}} // expected-error{{invalid token after top level declarator}} -template void X1::f0(int); // expected-error 3{{implicit instantiation of undefined template}} // expected-error{{invalid token after top level declarator}} +template void X0::f0(int); // expected-error {{incomplete type}} +template void X1::f0(int); // expected-error {{implicit instantiation of undefined template}} // A definition of a class template or class member template shall be in scope // at the point of the explicit instantiation of the class template or class @@ -33,11 +32,10 @@ template struct X2::Inner; // expected-error{{explicit instantiation // A definition of a class template shall be in scope at the point of an // explicit instantiation of a member function or a static data member of the // class template. -template void X1::f1(int); // expected-error 2{{undefined template}} \ - // expected-error{{does not refer}} +template void X1::f1(int); // expected-error {{undefined template}} +template void X1::f1(int); // expected-error {{undefined template}} -template int X1::member; // expected-error 2{{undefined template}} \ - // expected-error{{does not refer}} +template int X1::member; // expected-error {{undefined template}} // A definition of a member class of a class template shall be in scope at the // point of an explicit instantiation of the member class. diff --git a/test/SemaCXX/nested-name-spec.cpp b/test/SemaCXX/nested-name-spec.cpp index c6b11cfefe..cff04ab17a 100644 --- a/test/SemaCXX/nested-name-spec.cpp +++ b/test/SemaCXX/nested-name-spec.cpp @@ -165,8 +165,7 @@ void ::global_func2(int) { } // expected-error{{definition or redeclaration of ' void N::f() { } // okay struct Y; // expected-note{{forward declaration of 'Y'}} -Y::foo y; // expected-error{{incomplete type 'Y' named in nested name specifier}} \ - // expected-error{{no type named 'foo' in}} +Y::foo y; // expected-error{{incomplete type 'Y' named in nested name specifier}} X::X() : a(5) { } // expected-error{{use of undeclared identifier 'X'}} \ // expected-error{{C++ requires a type specifier for all declarations}} \ @@ -224,9 +223,8 @@ namespace test2 { // PR6259, invalid case namespace test3 { - // FIXME: this should really only trigger once - class A; // expected-note 2 {{forward declaration}} + class A; // expected-note {{forward declaration}} void foo(const char *path) { - A::execute(path); // expected-error 2 {{incomplete type 'test3::A' named in nested name specifier}} + A::execute(path); // expected-error {{incomplete type 'test3::A' named in nested name specifier}} } } diff --git a/test/SemaTemplate/instantiate-function-params.cpp b/test/SemaTemplate/instantiate-function-params.cpp index ea8dd70619..cfca020aad 100644 --- a/test/SemaTemplate/instantiate-function-params.cpp +++ b/test/SemaTemplate/instantiate-function-params.cpp @@ -29,8 +29,7 @@ template < typename TT > struct ForwardIterator : I typedef instantiate< & requirement_ x)>::failed> boost_concept_check2; // expected-note 2 {{in instantiation}} }; -typedef instantiate< &requirement_ x)>::failed> boost_concept_checkX; // expected-error{{no member named}} \ -// expected-note 6{{in instantiation}} +typedef instantiate< &requirement_ x)>::failed> boost_concept_checkX;// expected-note 6{{in instantiation}} template struct X0 { }; template struct X0 { }; diff --git a/test/SemaTemplate/instantiate-typedef.cpp b/test/SemaTemplate/instantiate-typedef.cpp index bb168a1c93..4e6cd24111 100644 --- a/test/SemaTemplate/instantiate-typedef.cpp +++ b/test/SemaTemplate/instantiate-typedef.cpp @@ -11,6 +11,5 @@ add_pointer::type test2(int * ptr) { return ptr; // expected-error{{cannot initialize return object of type 'add_pointer::type' (aka 'float *') with an lvalue of type 'int *'}} } -add_pointer::type // expected-note{{in instantiation of template class 'add_pointer' requested here}} \ -// expected-error {{no type named 'type' in 'add_pointer'}} +add_pointer::type // expected-note{{in instantiation of template class 'add_pointer' requested here}} test3(); diff --git a/test/SemaTemplate/typename-specifier.cpp b/test/SemaTemplate/typename-specifier.cpp index 42766a0620..3f6fe343f5 100644 --- a/test/SemaTemplate/typename-specifier.cpp +++ b/test/SemaTemplate/typename-specifier.cpp @@ -42,13 +42,10 @@ namespace N { } N::X::type *ip4 = &i; -N::X::type *ip5 = &i; // expected-note{{in instantiation of template class 'N::X' requested here}} \ -// expected-error{{no type named 'type' in}} -N::X::type *ip6 = &i; // expected-note{{in instantiation of template class 'N::X' requested here}} \ -// expected-error{{no type named 'type' in}} +N::X::type *ip5 = &i; // expected-note{{in instantiation of template class 'N::X' requested here}} +N::X::type *ip6 = &i; // expected-note{{in instantiation of template class 'N::X' requested here}} -N::X::type fail1; // expected-note{{in instantiation of template class 'N::X' requested here}} \ -// expected-error{{no type named 'type' in}} +N::X::type fail1; // expected-note{{in instantiation of template class 'N::X' requested here}} template struct Y { @@ -69,7 +66,5 @@ struct C { }; ::Y::type ip7 = &i; -::Y::type ip8 = &i; // expected-note{{in instantiation of template class 'Y' requested here}} \ -// expected-error{{no type named 'type' in}} -::Y::type ip9 = &i; // expected-note{{in instantiation of template class 'Y' requested here}} \ -// expected-error{{no type named 'type' in}} +::Y::type ip8 = &i; // expected-note{{in instantiation of template class 'Y' requested here}} +::Y::type ip9 = &i; // expected-note{{in instantiation of template class 'Y' requested here}} -- 2.40.0