blob: 7cb50e378daee89c45fbe2f93d35dbf22f4755ed (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
|
// RUN: %clang_cc1 -fsyntax-only -verify -Wall -std=c++11 %s -Wno-unused-value
namespace std {
template <typename T>
void dummy(T &&) {}
template <typename T>
T &&move(T &&x) { return x; }
template <typename T, typename U>
void move(T &&, U &&) {}
inline namespace __1 {
template <typename T>
T &forward(T &x) { return x; }
} // namespace __1
struct foo {};
} // namespace std
namespace global {
using namespace std;
void f() {
int i = 0;
std::move(i);
move(i); // expected-warning{{unqualified call to 'std::move'}}
(move)(i); // expected-warning{{unqualified call to 'std::move'}}
std::dummy(1);
dummy(1);
std::move(1, 2);
move(1, 2);
forward<int>(i); // expected-warning{{unqualified call to 'std::forward'}}
std::forward<int>(i);
}
template <typename T>
void g(T &&foo) {
std::move(foo);
move(foo); // expected-warning{{unqualified call to 'std::move}}
std::forward<decltype(foo)>(foo);
forward<decltype(foo)>(foo); // expected-warning{{unqualified call to 'std::forward}}
move(1, 2);
dummy(foo);
}
void call() {
g(0); //expected-note {{here}}
}
} // namespace global
namespace named {
using std::forward;
using std::move;
void f() {
int i = 0;
move(i); // expected-warning{{unqualified call to 'std::move}}
move(1, 2);
forward<int>(i); // expected-warning{{unqualified call to 'std::forward}}
}
template <typename T>
void g(T &&foo) {
move(foo); // expected-warning{{unqualified call to 'std::move}}
forward<decltype(foo)>(foo); // expected-warning{{unqualified call to 'std::forward}}
(forward<decltype(foo)>)(foo); // expected-warning{{unqualified call to 'std::forward}}
move(1, 2);
}
void call() {
g(0); //expected-note {{here}}
}
} // namespace named
namespace overload {
using namespace std;
template <typename T>
int move(T &&);
void f() {
int i = 0;
move(i);
}
} // namespace overload
namespace adl {
void f() {
move(std::foo{}); // expected-warning{{unqualified call to 'std::move}}
}
} // namespace adl
namespace std {
void f() {
int i = 0;
move(i); // expected-warning{{unqualified call to 'std::move}}
forward<int>(i); // expected-warning{{unqualified call to 'std::forward}}
}
} // namespace std
namespace test_alias {
namespace alias = std;
using namespace alias;
void f() {
int i = 0;
move(i); // expected-warning{{unqualified call to 'std::move}}
move(1, 2);
forward<int>(i); // expected-warning{{unqualified call to 'std::forward}}
}
} // namespace test_alias
|