Michael Hofmann - 2015-03-13

This would be an extremely useful feature, and I'd like to see this picked up.

I have code that puts the return type on a separate line, and it gets wrongly reformatted using an instatement indent (unfortunately, it doesn't seem to be legal to set max-instatement-indent=0).

More specifically, in my particular configuration, this snippet:

template <typename Scalar>
std::pair<std::vector<typename Foo<Scalar>::SampleType>, std::vector<typename Foo<Scalar>::ScalarType>>
Foo<Scalar>::bar(const std::vector<SampleType>& examples, const std::vector<ScalarType>& labels, const std::vector<ScalarType>& distribution)
{
}

gets reformatted to

template <typename Scalar>
std::pair<std::vector<typename Foo<Scalar>::SampleType>, std::vector<typename Foo<Scalar>::ScalarType>>
        Foo<Scalar>::bar(const std::vector<SampleType>& examples, const std::vector<ScalarType>& labels, const std::vector<ScalarType>& distribution)
{
}

which should not be happening. There is no sane reason to indent the function name.

Astyle knowing about putting the return type on a separate line would help.
clang-format features a bit more (though not enough) control over the process. Ideally, I would like to put the return type on a separate line if it becomes to long (e.g. past a configurable number of characters), but not otherwise.