Index: lib/TableGen/TGParser.cpp =================================================================== --- lib/TableGen/TGParser.cpp +++ lib/TableGen/TGParser.cpp @@ -2277,6 +2277,10 @@ while (Lex.getCode() == tgtok::comma) { Lex.Lex(); // Eat the comma + // ignore trailing comma for lists + if (Lex.getCode() == tgtok::r_square) + return; + if (ArgsRec && !EltTy) { ArrayRef TArgs = ArgsRec->getTemplateArgs(); if (ArgN >= TArgs.size()) { Index: test/TableGen/ListArgs.td =================================================================== --- test/TableGen/ListArgs.td +++ test/TableGen/ListArgs.td @@ -10,3 +10,7 @@ def OneB : BBB<[[1,2,3]]>; def TwoB : BBB<[[1,2,3],[4,5,6]]>; + +def ThreeB: BBB<[[1,2,3], + [4,5,6], + ]>;