Index: lib/TableGen/TGParser.cpp =================================================================== --- lib/TableGen/TGParser.cpp +++ lib/TableGen/TGParser.cpp @@ -1673,18 +1673,16 @@ RecTy *EltTy = nullptr; for (Init *V : Vals) { TypedInit *TArg = dyn_cast(V); - if (!TArg) { - TokError("Untyped list element"); - return nullptr; - } - if (EltTy) { - EltTy = resolveTypes(EltTy, TArg->getType()); - if (!EltTy) { - TokError("Incompatible types in list elements"); - return nullptr; + if (TArg) { + if (EltTy) { + EltTy = resolveTypes(EltTy, TArg->getType()); + if (!EltTy) { + TokError("Incompatible types in list elements"); + return nullptr; + } + } else { + EltTy = TArg->getType(); } - } else { - EltTy = TArg->getType(); } } Index: test/TableGen/dag-functional.td =================================================================== --- test/TableGen/dag-functional.td +++ test/TableGen/dag-functional.td @@ -8,7 +8,7 @@ // } // CHECK: def A1 { -// dag ret = (ops 1:$a, 2:$b); +// dag ret = (ops ?:$a, 1:$b, 2); // } // CHECK: def B0 { @@ -40,7 +40,7 @@ } def A0 : A<[], []>; -def A1 : A<[1, 2], ["a", "b"]>; +def A1 : A<[?, 1, 2], ["a", "b", ?]>; def B0 : B<[]>; def B1 : B<[Node<1, "a">, Node<2, "b">]>;