summaryrefslogtreecommitdiffstats
path: root/test/CXX/temp
diff options
context:
space:
mode:
Diffstat (limited to 'test/CXX/temp')
-rw-r--r--test/CXX/temp/p3.cpp20
-rw-r--r--test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.call/p3.cpp25
-rw-r--r--test/CXX/temp/temp.res/temp.local/p3.cpp8
-rw-r--r--test/CXX/temp/temp.spec/temp.explicit/p7.cpp4
4 files changed, 50 insertions, 7 deletions
diff --git a/test/CXX/temp/p3.cpp b/test/CXX/temp/p3.cpp
new file mode 100644
index 0000000..16ebb38
--- /dev/null
+++ b/test/CXX/temp/p3.cpp
@@ -0,0 +1,20 @@
+// RUN: %clang_cc1 -verify %s
+
+template<typename T> struct S {
+ static int a, b;
+};
+
+template<typename T> int S<T>::a, S<T>::b; // expected-error {{can only declare a single entity}}
+
+// FIXME: the last two diagnostics here are terrible.
+template<typename T> struct A { static A a; } A<T>::a; // expected-error {{expected ';' after struct}} \
+ expected-error {{use of undeclared identifier 'T'}} \
+ expected-error {{cannot name the global scope}} \
+ expected-error {{no member named 'a' in the global namespace}}
+
+template<typename T> struct B { } f(); // expected-error {{expected ';' after struct}} \
+ expected-error {{requires a type specifier}}
+
+template<typename T> struct C { } // expected-error {{expected ';' after struct}}
+
+A<int> c;
diff --git a/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.call/p3.cpp b/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.call/p3.cpp
index 3c22cf3..295f080 100644
--- a/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.call/p3.cpp
+++ b/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.call/p3.cpp
@@ -71,7 +71,21 @@ void test_f3(int ***ip, volatile int ***vip) {
A<int> a0 = f3(ip);
A<volatile int> a1 = f3(vip);
}
-
+
+// Also accept conversions for pointer types which require removing
+// [[noreturn]].
+namespace noreturn_stripping {
+ template <class R>
+ void f(R (*function)());
+
+ void g() __attribute__ ((__noreturn__));
+ void h();
+ void test() {
+ f(g);
+ f(h);
+ }
+}
+
// - If P is a class, and P has the form template-id, then A can be a
// derived class of the deduced A. Likewise, if P is a pointer to a class
// of the form template-id, A can be a pointer to a derived class pointed
@@ -123,3 +137,12 @@ namespace N {
N::F<T1>(d); // OK
}
}
+
+namespace PR9233 {
+ template<typename T> void f(const T **q); // expected-note{{candidate template ignored: substitution failure [with T = int]}}
+
+ void g(int **p) {
+ f(p); // expected-error{{no matching function for call to 'f'}}
+ }
+
+}
diff --git a/test/CXX/temp/temp.res/temp.local/p3.cpp b/test/CXX/temp/temp.res/temp.local/p3.cpp
index 88f8963..54da885 100644
--- a/test/CXX/temp/temp.res/temp.local/p3.cpp
+++ b/test/CXX/temp/temp.res/temp.local/p3.cpp
@@ -22,11 +22,11 @@ template <class T> struct Derived: Base<int>, Base<char> {
namespace PR6717 {
template <typename T>
class WebVector {
- }
+ } // expected-error {{expected ';' after class}}
- WebVector(const WebVector<T>& other) { }
+ WebVector(const WebVector<T>& other) { } // expected-error{{undeclared identifier 'T'}} \
+ expected-error{{requires a type specifier}}
template <typename C>
- WebVector<T>& operator=(const C& other) { } // expected-error{{unknown type name 'WebVector'}} \
- // expected-error{{unqualified-id}}
+ WebVector<T>& operator=(const C& other) { } // expected-error{{undeclared identifier 'T'}}
}
diff --git a/test/CXX/temp/temp.spec/temp.explicit/p7.cpp b/test/CXX/temp/temp.spec/temp.explicit/p7.cpp
index b62e0cb..7398dca 100644
--- a/test/CXX/temp/temp.spec/temp.explicit/p7.cpp
+++ b/test/CXX/temp/temp.spec/temp.explicit/p7.cpp
@@ -7,14 +7,14 @@ struct X0 {
};
T* f0(T* ptr) {
- return ptr + 1; // expected-error{{pointer to function}}
+ return ptr + 1; // expected-error{{pointer to the function}}
}
static T* static_member;
};
template<typename T>
-T* X0<T>::static_member = ((T*)0) + 1; // expected-error{{pointer to function}}
+T* X0<T>::static_member = ((T*)0) + 1; // expected-error{{pointer to the function}}
template class X0<int>; // okay
OpenPOWER on IntegriCloud