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
virtual a* unqualified_vs_const_volatile_class(); // expected-note{{overridden virtual function is here}}
104
104
105
-
// Non Classes.
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
+
// Check non class.
106
116
virtualconstint* const_vs_unqualified_non_class(); // expected-note{{overridden virtual function is here}}
107
117
virtualint* unqualified_vs_const_non_class(); // expected-note{{overridden virtual function is here}}
108
118
};
109
119
110
120
classB : A {
111
-
//Classes.
121
+
//Check cv-qualification.
112
122
a* const_vs_unqualified_class() override;
113
123
const a* unqualified_vs_const_class() override; // expected-error{{return type of virtual function 'unqualified_vs_const_class' is not covariant with the return type of the function it overrides (class type 'const a *' does not have the same cv-qualification as or less cv-qualification than class type 'a *')}}
114
124
@@ -127,7 +137,17 @@ class B : A {
127
137
a* const_volatile_vs_unualified_class() override;
128
138
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 *')}}
129
139
130
-
// Non Classes.
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
+
// Check non class.
131
151
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 *')}}
132
152
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