Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#253 C++11 member initializer list with curly brackets misindented

closed-fixed
Jim Pattee
None
7
2015-01-03
2013-11-23
Thomas Braun
No

Using "Artistic Style Version 2.04" the extended initializer list from C++11 is misformatted.
Input:

struct A
{
  A(int a, int b)
  :
  m_a {a},
  m_b {a}
  {}

  int m_a;
  int m_b;
};

struct B
{
  B(int a, int b)
  :
  m_a (a),
  m_b (a)
  {}

  int m_a;
  int m_b;
};

Output from ./astyle --indent=spaces=2 <test.cpp:

struct A
{
  A(int a, int b)
    :
    m_a {a},
      m_b {a} // indented but should not
  {}

  int m_a;
  int m_b;
};

struct B
{
  B(int a, int b)
    :
    m_a (a),
    m_b (a)
  {}

  int m_a;
  int m_b;
};

Discussion

  • Jim Pattee
    Jim Pattee
    2014-10-15

    • status: open --> open-fixed
    • assigned_to: Jim Pattee
    • Priority: 5 --> 7
     
  • Jim Pattee
    Jim Pattee
    2014-10-15

    Fixed.

     
  • Jim Pattee
    Jim Pattee
    2014-11-20

    • Status: open-fixed --> closed-fixed