Debian Codegraph @

clang-tools-extra/docs/clang-tidy/checks/fuchsia/trailing-return.rst

raw
1 .. title:: clang-tidy - fuchsia-trailing-return
2
3 fuchsia-trailing-return
4 =======================
5
6 Functions that have trailing returns are disallowed, except for those using
7 ``decltype`` specifiers and lambda with otherwise unutterable return types.
8
9 For example:
10
11 .. code-block:: c++
12
13 // No warning
14 int add_one(const int arg) { return arg; }
15
16 // Warning
17 auto get_add_one() -> int (*)(const int) {
18 return add_one;
19 }
20
21 Exceptions are made for lambdas and ``decltype`` specifiers:
22
23 .. code-block:: c++
24
25 // No warning
26 auto lambda = [](double x, double y) -> double {return x + y;};
27
28 // No warning
29 template <typename T1, typename T2>
30 auto fn(const T1 &lhs, const T2 &rhs) -> decltype(lhs + rhs) {
31 return lhs + rhs;
32 }
33
34
35 See the features disallowed in Fuchsia at https://fuchsia.dev/fuchsia-src/development/languages/c-cpp/cxx?hl=en