Skip to content

Commit 79920eb

Browse files
committed
Fix auto rules
1 parent 7d0b369 commit 79920eb

3 files changed

Lines changed: 7 additions & 4 deletions

File tree

‎rules/iomanip/src.cpp‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33

44
#include <iomanip>
55

6-
auto f1(int n) { return std::setw(n); }
6+
auto f1(int n) -> decltype(std::setw(n)) { return std::setw(n); }

‎rules/pair/src.cpp‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,14 @@ std::pair<T1, T2> f7(T3 &&a0, T4 &&a1) {
3434
return std::pair<T1, T2>(std::move(a0), std::move(a1));
3535
}
3636

37-
template <class T1, class T2> auto f9(T1 &&a0, T2 &a1) {
37+
template <class T1, class T2>
38+
auto f9(T1 &&a0, T2 &a1) -> decltype(std::make_pair(std::move(a0), a1)) {
3839
return std::make_pair(std::move(a0), a1);
3940
}
4041

41-
template <class T1, class T2> auto f10(T1 &&a0, T2 &&a1) {
42+
template <class T1, class T2>
43+
auto f10(T1 &&a0, T2 &&a1)
44+
-> decltype(std::make_pair(std::move(a0), std::move(a1))) {
4245
return std::make_pair(std::move(a0), std::move(a1));
4346
}
4447

‎rules/string/src.cpp‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ std::string &f4(std::string &s, const char *p, std::size_t n) {
2323

2424
const char *f5(const std::string &s) { return s.c_str(); }
2525

26-
char *f6(std::string &s) { return s.data(); }
26+
auto f6(std::string &s) -> decltype(s.data()) { return s.data(); }
2727

2828
std::string f7(const char *s, std::size_t n) { return std::string(s, n); }
2929

0 commit comments

Comments
 (0)