3

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.

Claudius
  • 550
  • 3
  • 14
  • 3
    I'm voting to close this question as off-topic because it belongs to http://emacs.stackexchange.com/. – wilx Dec 24 '15 at 23:18
  • @wilx Fair point, I’ve reposted there; maybe a hint in the description of the “emacs” tag would be possible? – Claudius Dec 25 '15 at 08:05
  • Cf. http://emacs.stackexchange.com/questions/19070/cc-mode-doesnt-indent-arguments-to-templated-functions-starting-with-a-curly-br – wilx Dec 25 '15 at 17:20

0 Answers0