You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: clang/test/CXX/drs/cwg9xx.cpp
+32Lines changed: 32 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -93,6 +93,38 @@ struct B : A {
93
93
} // namespace example2
94
94
} // namespace cwg952
95
95
96
+
namespacecwg960 { // cwg960: 2.8
97
+
structa {};
98
+
classA {
99
+
#if __cplusplus >= 201103L
100
+
// Check lvalue ref vs rvalue ref vs pointer.
101
+
virtual a& rvalue_ref();
102
+
virtual a&& lvalue_ref();
103
+
virtual a& rvalue_vs_lvalue_ref(); // expected-note{{overridden virtual function is here}}
104
+
virtual a&& lvalue_vs_rvalue_ref(); // expected-note{{overridden virtual function is here}}
105
+
virtual a& rvalue_ref_vs_pointer(); // expected-note{{overridden virtual function is here}}
106
+
virtual a* pointer_vs_rvalue_ref(); // expected-note{{overridden virtual function is here}}
107
+
virtual a&& lvalue_ref_vs_pointer(); // expected-note{{overridden virtual function is here}}
108
+
virtual a* pointer_vs_lvalue_ref(); // expected-note{{overridden virtual function is here}}
109
+
#endif
110
+
};
111
+
112
+
classB : A {
113
+
#if __cplusplus >= 201103L
114
+
// Check lvalue ref vs rvalue ref vs pointer.
115
+
a& rvalue_ref() override;
116
+
a&& lvalue_ref() override;
117
+
a&& rvalue_vs_lvalue_ref() override; // expected-error{{virtual function 'rvalue_vs_lvalue_ref' has a different return type ('a &&') than the function it overrides (which has return type 'a &')}}
118
+
a& lvalue_vs_rvalue_ref() override; // expected-error{{virtual function 'lvalue_vs_rvalue_ref' has a different return type ('a &') than the function it overrides (which has return type 'a &&')}}
119
+
a* rvalue_ref_vs_pointer() override; // expected-error{{virtual function 'rvalue_ref_vs_pointer' has a different return type ('a *') than the function it overrides (which has return type 'a &')}}
120
+
a& pointer_vs_rvalue_ref() override; // expected-error{{virtual function 'pointer_vs_rvalue_ref' has a different return type ('a &') than the function it overrides (which has return type 'a *')}}
121
+
a* lvalue_ref_vs_pointer() override; // expected-error{{virtual function 'lvalue_ref_vs_pointer' has a different return type ('a *') than the function it overrides (which has return type 'a &&')}}
122
+
a&& pointer_vs_lvalue_ref() override; // expected-error{{virtual function 'pointer_vs_lvalue_ref' has a different return type ('a &&') than the function it overrides (which has return type 'a *')}}
virtual a* unqualified_vs_const_volatile_class(); // expected-note{{overridden virtual function is here}}
104
104
105
-
// Check lvalue ref vs rvalue ref vs pointer.
106
-
virtual a& rvalue_ref();
107
-
virtual a&& lvalue_ref();
108
-
virtual a& rvalue_vs_lvalue_ref(); // expected-note{{overridden virtual function is here}}
109
-
virtual a&& lvalue_vs_rvalue_ref(); // expected-note{{overridden virtual function is here}}
110
-
virtual a& rvalue_ref_vs_pointer(); // expected-note{{overridden virtual function is here}}
111
-
virtual a* pointer_vs_rvalue_ref(); // expected-note{{overridden virtual function is here}}
112
-
virtual a&& lvalue_ref_vs_pointer(); // expected-note{{overridden virtual function is here}}
113
-
virtual a* pointer_vs_lvalue_ref(); // expected-note{{overridden virtual function is here}}
114
-
115
105
// Check non class.
116
106
virtualconstint* const_vs_unqualified_non_class(); // expected-note{{overridden virtual function is here}}
117
107
virtualint* unqualified_vs_const_non_class(); // expected-note{{overridden virtual function is here}}
@@ -137,16 +127,6 @@ class B : A {
137
127
a* const_volatile_vs_unualified_class() override;
138
128
constvolatile a* unqualified_vs_const_volatile_class() override; // expected-error{{return type of virtual function 'unqualified_vs_const_volatile_class' is not covariant with the return type of the function it overrides (class type 'const volatile a *' does not have the same cv-qualification as or less cv-qualification than class type 'a *')}}
139
129
140
-
// Check lvalue ref vs rvalue ref vs pointer.
141
-
a& rvalue_ref() override;
142
-
a&& lvalue_ref() override;
143
-
a&& rvalue_vs_lvalue_ref() override; // expected-error{{virtual function 'rvalue_vs_lvalue_ref' has a different return type ('a &&') than the function it overrides (which has return type 'a &')}}
144
-
a& lvalue_vs_rvalue_ref() override; // expected-error{{virtual function 'lvalue_vs_rvalue_ref' has a different return type ('a &') than the function it overrides (which has return type 'a &&')}}
145
-
a* rvalue_ref_vs_pointer() override; // expected-error{{virtual function 'rvalue_ref_vs_pointer' has a different return type ('a *') than the function it overrides (which has return type 'a &')}}
146
-
a& pointer_vs_rvalue_ref() override; // expected-error{{virtual function 'pointer_vs_rvalue_ref' has a different return type ('a &') than the function it overrides (which has return type 'a *')}}
147
-
a* lvalue_ref_vs_pointer() override; // expected-error{{virtual function 'lvalue_ref_vs_pointer' has a different return type ('a *') than the function it overrides (which has return type 'a &&')}}
148
-
a&& pointer_vs_lvalue_ref() override; // expected-error{{virtual function 'pointer_vs_lvalue_ref' has a different return type ('a &&') than the function it overrides (which has return type 'a *')}}
149
-
150
130
// Check non class.
151
131
int* const_vs_unqualified_non_class() override; // expected-error{{virtual function 'const_vs_unqualified_non_class' has a different return type ('int *') than the function it overrides (which has return type 'const int *')}}
152
132
constint* unqualified_vs_const_non_class() override; // expected-error{{virtual function 'unqualified_vs_const_non_class' has a different return type ('const int *') than the function it overrides (which has return type 'int *')}}
0 commit comments