Menu

#606 Curly braces prevent indentation (in lambda)

open-accepted
None
2026-02-18
2026-02-17
Zenju
No

AStyle built from git 2026-02-13 fails to converts this

void test()
{
    Zstring targetExePath = appendPath(targetExePath, [&]
    {
        if (getOsVersion().version < OsVersion{6, 1})
        throw FileError();

        if (getOsVersion().version < OsVersion{10, 0} /*Windows 10*/)
        throw FileError();
    }());
}

into (expected):

void test()
{
    Zstring targetExePath = appendPath(targetExePath, [&]
    {
        if (getOsVersion().version < OsVersion{6, 1})
            throw FileError();

        if (getOsVersion().version < OsVersion{10, 0} /*Windows 10*/)
            throw FileError();
    }());
}

using

--style=allman
--suffix=none
--formatted
--lineend=linux
--convert-tabs
--keep-one-line-blocks
--keep-one-line-statements
--align-pointer=type
--min-conditional-indent=1
--max-continuation-indent=80
--indent-switches
--indent-col1-comments
--indent-preproc-block
--indent-preproc-define
--indent-labels
--pad-header
--pad-comma
--pad-include
--preserve-ws

Discussion

  • Zenju

    Zenju - 2026-02-17

    following issue might be related:

    actual:

    if (std::count(pkStream.begin(), pkStream.end(), ' ') == 2 &&
    std::all_of(pkStream.begin(), pkStream.end(), [](const char c) { return isDigit(c) || c == ' '; }))
    return L"SSH-1 public key";
    

    expected:

    if (std::count(pkStream.begin(), pkStream.end(), ' ') == 2 &&
        std::all_of(pkStream.begin(), pkStream.end(), [](const char c) { return isDigit(c) || c == ' '; }))
        return L"SSH-1 public key";
    
     
  • André Simon

    André Simon - 2026-02-18

    The first issue is related to this initializer list: OsVersion{6, 1}

     
  • André Simon

    André Simon - 2026-02-18
    • status: open --> open-accepted
    • assigned_to: André Simon
     

Log in to post a comment.

MongoDB Logo MongoDB