Menu

#148 indent fail with some bitfield pattern

closed-fixed
2024-10-01
2012-04-18
No

AStyle version : 2.02.1 on Windows
default option.

-- 8< --
#define FOUR 4

class Foo
{
int bitfield_0 : 1;
int bitfield_1
:
2;
int bitfield_2 : FOUR;
};
-->8--

bitfield_0 : 1 is indented correctly.
bitfield_1, 2 is indented correctly but not :
bitfield_2 is not indented correctly.

Discussion

  • Soren Pingel Dalsgaard

    Not sure if this is related but

    typedef foo
    {
    __const int bar;
    __int baz;
    };

    is indented correctly, but adding a bitfield specified ":<number>" on bar will indent wrong:</number>

    typedef foo
    {
    const int bar:_2;
    ____int baz;
    };

    However, removing "const" also 'fixes' i:

    typedef foo
    {
    __int bar:_2;
    __int baz;
    }

    So the combination of "const"+"bitfield" seems to break things.

    I am using "_" as space indicator. One space is inserted between ":" and "2" and the rest is indented two spaces extra.

     

    Last edit: Soren Pingel Dalsgaard 2015-11-11
  • André Simon

    André Simon - 2024-01-21
    • status: open --> open-accepted
    • assigned_to: André Simon
     
  • André Simon

    André Simon - 2024-10-01
    • status: open-accepted --> closed-fixed
     
  • André Simon

    André Simon - 2024-10-01

    Fixed in 3.6.3.

     

Log in to post a comment.

Auth0 Logo