aboutsummaryrefslogtreecommitdiff
path: root/clang/test/CXX/drs/cwg2xx.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/test/CXX/drs/cwg2xx.cpp')
-rw-r--r--clang/test/CXX/drs/cwg2xx.cpp35
1 files changed, 35 insertions, 0 deletions
diff --git a/clang/test/CXX/drs/cwg2xx.cpp b/clang/test/CXX/drs/cwg2xx.cpp
index 37186e3..a4995dd 100644
--- a/clang/test/CXX/drs/cwg2xx.cpp
+++ b/clang/test/CXX/drs/cwg2xx.cpp
@@ -230,6 +230,38 @@ namespace cwg211 { // cwg211: 2.7
};
} // namespace cwg211
+namespace cwg212 { // cwg212: 2.7
+ template<typename T> struct Base;
+ template<typename T> struct Derived;
+
+ int *overload(void*);
+ float *overload(Base<int>*);
+ double *overload(Base<long>*);
+
+ void f(Derived<int> *p) {
+ // OK, calls void* overload.
+ int *a = overload(p);
+
+ Base<int> *q = p;
+ // expected-error@-1 {{cannot initialize a variable of type 'Base<int> *' with an lvalue of type 'Derived<int> *'}}
+ }
+
+ template<typename T> struct Base {};
+ template<typename T> struct Derived : Base<T> {};
+
+ void g(Derived<long> *p) {
+ // OK, instantiates and calls Base<long>* overlod.
+ double *b = overload(p);
+ (void)b;
+ }
+
+ void h(Derived<float> *p) {
+ // OK, instantiates and converts.
+ Base<float> *q = p;
+ (void)q;
+ }
+}
+
namespace cwg213 { // cwg213: 2.7
template <class T> struct A : T {
void h(T t) {
@@ -593,6 +625,9 @@ namespace cwg231 { // cwg231: 2.7
}
} // namespace cwg231
+// 232 is NAD; the desired behavior is described in 2823.
+// cwg232: dup 2823
+
// cwg234: na
// cwg235: na