<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/61631>61631</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            clang-format: IndentAccessModifiers causes an extra indent to be added in struct defined inside class declaration
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          cquick01
      </td>
    </tr>
</table>

<pre>
    So this might just be me doing something wrong, but it seems like clang-format is adding an extra indent inside my struct

Using `.clang-format`

```
---
BasedOnStyle: LLVM
BreakBeforeBraces: Allman
IndentWidth: 4
IndentAccessModifiers: true
```

I have a class that looks like this

```cpp
// this is my desired formatting
class MyClass
{
    public:
        MyClass();
 ~MyClass();

        struct MyStruct
        {
 bool first;
            bool second;
        };
};
```

And when trying to format with clang-format, it gets formatted like this with an extra indent before each variable within `MyStruct`.

```cpp
class MyClass
{
    public:
        MyClass();
 ~MyClass();

        struct MyStruct
        {
 bool first;
                bool second;
 };
};
```

If I change to

```
---
BasedOnStyle: LLVM
BreakBeforeBraces: Allman
IndentWidth: 4
AccessModifierOffset: -4
IndentAccessModifiers: false
```

it looks a bit better, but I'd rather the access modifier block was indented like the original

```cpp
class MyClass
{
public:
    MyClass();
 ~MyClass();

    struct MyStruct
    {
        bool first;
 bool second;
    };
};
```

Trying to set both `IndentAccessModifiers: true` and `AccessModifierOffset: -4` still looks like

```cpp
class MyClass
{
    public:
 MyClass();
        ~MyClass();

        struct MyStruct
 {
                bool first;
                bool second;
 };
};
```

Can anyone help fix my configuration to achieve my desired formatting? Thanks in advance.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzUVs1u2zgQfhr5MrChH1uuDzo4DQwEaNBDurvnETkSWVOklxwl9WWffUFJjp3GyaLdAosVDIvizIji90MSQ9CtJaqS1U2yup1hz8r5SvzZa7FPs1nt5LF6cMBKB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