Index: clang/lib/Format/QualifierAlignmentFixer.cpp =================================================================== --- clang/lib/Format/QualifierAlignmentFixer.cpp +++ clang/lib/Format/QualifierAlignmentFixer.cpp @@ -303,6 +303,8 @@ if (LastQual && Qual != LastQual && Qual->is(QualifierType)) { rotateTokens(SourceMgr, Fixes, Tok, Qual, /*Left=*/true); + if (!Qual->Next) + return Tok; Tok = Qual->Next; } else if (Tok->startsSequence(tok::identifier, QualifierType)) { if (Tok->Next->Next && Tok->Next->Next->isOneOf(tok::identifier, tok::star, Index: clang/unittests/Format/QualifierFixerTest.cpp =================================================================== --- clang/unittests/Format/QualifierFixerTest.cpp +++ clang/unittests/Format/QualifierFixerTest.cpp @@ -816,6 +816,7 @@ EXPECT_EQ(ReplacementCount, 0); verifyFormat("static const uint32 foo[] = {0, 31};", Style); verifyFormat("#define MACRO static const", Style); + verifyFormat("using sc = static const", Style); EXPECT_EQ(ReplacementCount, 0); }