@@ -16,6 +16,9 @@ void int_test() {
16
16
x = std::move (x); // expected-warning{{explicitly moving}}
17
17
(x) = std::move (x); // expected-warning{{explicitly moving}}
18
18
19
+ x = static_cast <int &&>(x); // expected-warning{{explicitly moving}}
20
+ (x) = static_cast <int &&>(x); // expected-warning{{explicitly moving}}
21
+
19
22
using std::move;
20
23
x = move (x); // expected-warning{{explicitly moving}} \
21
24
expected-warning {{unqualified call to 'std::move}}
@@ -26,6 +29,9 @@ void global_int_test() {
26
29
global = std::move (global); // expected-warning{{explicitly moving}}
27
30
(global) = std::move (global); // expected-warning{{explicitly moving}}
28
31
32
+ global = static_cast <int &&>(global); // expected-warning{{explicitly moving}}
33
+ (global) = static_cast <int &&>(global); // expected-warning{{explicitly moving}}
34
+
29
35
using std::move;
30
36
global = move (global); // expected-warning{{explicitly moving}} \
31
37
expected-warning {{unqualified call to 'std::move}}
@@ -35,11 +41,16 @@ class field_test {
35
41
int x;
36
42
field_test (field_test&& other) {
37
43
x = std::move (x); // expected-warning{{explicitly moving}}
44
+ x = static_cast <int &&>(x); // expected-warning{{explicitly moving}}
38
45
x = std::move (other.x );
46
+ x = static_cast <int &&>(other.x );
39
47
other.x = std::move (x);
48
+ other.x = static_cast <int &&>(x);
40
49
other.x = std::move (other.x ); // expected-warning{{explicitly moving}}
50
+ other.x = static_cast <int &&>(other.x ); // expected-warning{{explicitly moving}}
41
51
}
42
52
void withSuggest (int x) {
53
+ x = static_cast <int &&>(x); // expected-warning{{explicitly moving variable of type 'int' to itself; did you mean to move to member 'x'?}}
43
54
x = std::move (x); // expected-warning{{explicitly moving variable of type 'int' to itself; did you mean to move to member 'x'?}}
44
55
}
45
56
};
@@ -50,11 +61,15 @@ struct C { C() {}; ~C() {} };
50
61
void struct_test () {
51
62
A a;
52
63
a = std::move (a); // expected-warning{{explicitly moving}}
64
+ a = static_cast <A&&>(a); // expected-warning{{explicitly moving}}
53
65
54
66
B b;
55
67
b = std::move (b); // expected-warning{{explicitly moving}}
68
+ b = static_cast <B&&>(b); // expected-warning{{explicitly moving}}
56
69
b.a = std::move (b.a ); // expected-warning{{explicitly moving}}
70
+ b.a = static_cast <A&&>(b.a ); // expected-warning{{explicitly moving}}
57
71
58
72
C c;
59
73
c = std::move (c); // expected-warning{{explicitly moving}}
74
+ c = static_cast <C&&>(c); // expected-warning{{explicitly moving}}
60
75
}
0 commit comments