Consider the following snippet of C++ code, indented using cc-mode in Emacs:
auto good1 = f(a,
{1, 2}); // ((arglist-cont-nonempty 1 15))
auto bad1 = f<1>(a,
{1, 2}); // ((inexpr-statement) (block-open 36))
auto good2 = f(a,
b, // ((arglist-cont-nonempty 68 82))
{1, 2}); // ((arglist-cont-nonempty 68 82))
auto bad2 = f<1>(a,
b // ((arglist-cont-nonempty 114 130))
{1, 2}); // ((inexpr-statement) (block-open 114))
auto good3 = f(a,
b, // ((arglist-cont-nonempty 151 165))
{1, 2}, // ((arglist-cont-nonempty 151 165))
c);
auto bad3 = f<3>(a,
b, // ((arglist-cont-nonempty 209 225))
{1, 2}, // ((inexpr-statement) (block-open 209))
c);
As you can see, the curly-bracket-arguments {1, 2}
are not indented properly when occurring in a templated function call. This is due to them being wrongly labelled as ((inexpr-statement) (block-open X))
rather than ((arglist-cont-nonempty Y Z))
(the exact offsets may be different, I edited the comments after using C-c C-s
to get the syntactic labels).
Does anybody know how one can fix this? I tried the newest version of CC-Mode (5.32.5) specifically downloaded from Sourceforge as well as the default versions coming with Debian and Ubuntu, but all of them get this wrong.