Skip to content

[clang-format] Reference alignment options not honored for templated struct decltype(auto) operator()  #66890

Closed
llvm/llvm-project-release-prs
#770
@vient

Description

@vient
$ cat test.cpp
template<typename T>
struct A {
    decltype(auto) operator()(T& x) {
        return x;
    }
};

template<typename T>
struct B {
    auto operator()(T& x) {
        return x;
    }
};

clang-format-17 test.cpp produces

template <typename T> struct A {
  decltype(auto) operator()(T & x) { return x; }
};

template <typename T> struct B {
  auto operator()(T &x) { return x; }
};

Note that in A it produces T & x, in B T &x

$ clang-format-17 --version
Ubuntu clang-format version 17.0.0 (++20230918073327+88bf774c5650-1~exp1~20230918073342.41)

I'll note, just in case, that lack of config does not matter, same happens when ReferenceAlignment is defined.

Metadata

Metadata

Assignees

Type

No type

Projects

Status

Done

Relationships

None yet

Development

No branches or pull requests

Issue actions