Bug 492465 - Indentation in constructors fails for initializers after multiline initializers
Summary: Indentation in constructors fails for initializers after multiline initializers
Status: NEW
Alias: None
Product: CDT
Classification: Tools
Component: cdt-editor (show other bugs)
Version: 8.8.1   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact: Jonah Graham CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-04-26 11:52 EDT by Matt Godbolt CLA
Modified: 2020-09-04 15:25 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Matt Godbolt CLA 2016-04-26 11:52:41 EDT
After a multi-line initializer, future initializers have incorrect indentation when indented by eclipse.

Consider the code:

class Foo { Foo(int, int); };

struct Test {
  Foo a;
  Foo b;
  Test()
  : a(1,
      2),
    b(1, 2) {}
};

(Note the a() initializer spans two lines).

When auto-indented (ctrl-I), the constructor is incorrectly formatted to:

  Test()
  : a(1,
      2),
      b(1, 2) {}

That is, the 'b' is aligned as if it were a parameter for 'a'.

Ideally it should align with 'a', just like it does if one puts the 'a(1, 2)' on a single line:

  Test()
  : a(1, 2),
    b(1, 2) {}
Comment 1 Matt Godbolt CLA 2016-04-28 18:53:50 EDT
I have fiddled about a bit and have a patch which appears to fix this. I'll look at what it would take to sort out the CLA and prepare a patch for comment.