@@ -813,9 +813,8 @@ static bool CheckConstexprDeclStmt(Sema &SemaRef, const FunctionDecl *Dcl,
813
813
// C++11 [dcl.constexpr]p3 and p4:
814
814
// The definition of a constexpr function(p3) or constructor(p4) [...] shall
815
815
// contain only
816
- for (DeclStmt::decl_iterator DclIt = DS->decl_begin(),
817
- DclEnd = DS->decl_end(); DclIt != DclEnd; ++DclIt) {
818
- switch ((*DclIt)->getKind()) {
816
+ for (const auto *DclIt : DS->decls()) {
817
+ switch (DclIt->getKind()) {
819
818
case Decl::StaticAssert:
820
819
case Decl::Using:
821
820
case Decl::UsingShadow:
@@ -831,7 +830,7 @@ static bool CheckConstexprDeclStmt(Sema &SemaRef, const FunctionDecl *Dcl,
831
830
case Decl::TypeAlias: {
832
831
// - typedef declarations and alias-declarations that do not define
833
832
// classes or enumerations,
834
- TypedefNameDecl *TN = cast<TypedefNameDecl>(* DclIt);
833
+ const auto *TN = cast<TypedefNameDecl>(DclIt);
835
834
if (TN->getUnderlyingType()->isVariablyModifiedType()) {
836
835
// Don't allow variably-modified types in constexpr functions.
837
836
TypeLoc TL = TN->getTypeSourceInfo()->getTypeLoc();
@@ -846,7 +845,7 @@ static bool CheckConstexprDeclStmt(Sema &SemaRef, const FunctionDecl *Dcl,
846
845
case Decl::Enum:
847
846
case Decl::CXXRecord:
848
847
// C++1y allows types to be defined, not just declared.
849
- if (cast<TagDecl>(* DclIt)->isThisDeclarationADefinition())
848
+ if (cast<TagDecl>(DclIt)->isThisDeclarationADefinition())
850
849
SemaRef.Diag(DS->getLocStart(),
851
850
SemaRef.getLangOpts().CPlusPlus1y
852
851
? diag::warn_cxx11_compat_constexpr_type_definition
@@ -865,7 +864,7 @@ static bool CheckConstexprDeclStmt(Sema &SemaRef, const FunctionDecl *Dcl,
865
864
// C++1y [dcl.constexpr]p3 allows anything except:
866
865
// a definition of a variable of non-literal type or of static or
867
866
// thread storage duration or for which no initialization is performed.
868
- VarDecl *VD = cast<VarDecl>(* DclIt);
867
+ const auto *VD = cast<VarDecl>(DclIt);
869
868
if (VD->isThisDeclarationADefinition()) {
870
869
if (VD->isStaticLocal()) {
871
870
SemaRef.Diag(VD->getLocation(),
0 commit comments