[PATCH] D42116: [clang-tidy] Adding Fuchsia checker for trailing returns
Aaron Ballman via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Jan 16 14:10:34 PST 2018
aaron.ballman added a comment.
In https://reviews.llvm.org/D42116#977588, @juliehockett wrote:
> In https://reviews.llvm.org/D42116#977347, @aaron.ballman wrote:
>
> > Can you give some background on what problem the coding standard is trying to avoid by banning this? For instance, if trailing return types are bad, are deduced return types similarly bad, or are those fine?
>
>
> The main concern is that of readability. Deduced return types can help readability, so those are okay (within reason).
Thanks for the explanation. I'm a bit worried that this is going to diagnose reasonable C++11 code:
template <typename T1, typename T2>
auto fn(const T1 &lhs, const T2 &rhs) -> decltype(lhs + rhs) {
return lhs + rhs;
}
Would it be a reasonable exception to the rule to allow a trailing return type so long as it's a `decltype` type specifier?
https://reviews.llvm.org/D42116
More information about the cfe-commits
mailing list