File tree Expand file tree Collapse file tree 1 file changed +9
-0
lines changed
Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change 18361836auto g() { return 0.0; } // OK, \tcode {g} returns \tcode {double}
18371837auto (*fp)() -> auto = f; // OK
18381838auto h(); // OK, \tcode {h}'s return type will be deduced when it is defined
1839+ auto j() -> auto; // OK, deduction of \tcode {j}'s return type postponed at the definition
1840+ auto (*jp)() -> auto = j; // error, cannot use \tcode {j}'s before deducing its return type
1841+ auto (*kp)() -> auto; // error, not a function declaration; needs an initializer
1842+ constexpr auto l =
1843+ [](auto (*fp)() -> auto) // OK, \tcode {l}'s parameter \tcode {fp} is a function pointer,
1844+ { return fp; }; // whose return type will be deduced when \tcode {l} is invoked
1845+ int foo();
1846+ static_assert(l(foo) == foo); // OK
1847+
18391848\end {codeblock }
18401849\end {example }
18411850The \keyword {auto} \grammarterm {type-specifier}
You can’t perform that action at this time.
0 commit comments