aboutsummaryrefslogtreecommitdiff
path: root/test/SemaCXX
diff options
context:
space:
mode:
authorEd Schouten <ed@FreeBSD.org>2009-06-27 10:45:02 +0000
committerEd Schouten <ed@FreeBSD.org>2009-06-27 10:45:02 +0000
commit4ebdf5c4f587daef4e0be499802eac3a7a49bf2f (patch)
tree2c5a83521a20c02e7805581a174008aa9bc23579 /test/SemaCXX
parentf698f7e71940663e26a4806a96fb0bdfa160c886 (diff)
Notes
Diffstat (limited to 'test/SemaCXX')
-rw-r--r--test/SemaCXX/auto-cxx0x.cpp5
-rw-r--r--test/SemaCXX/auto-cxx98.cpp5
-rw-r--r--test/SemaCXX/basic_lookup_argdep.cpp13
-rw-r--r--test/SemaCXX/decltype-pr4444.cpp6
-rw-r--r--test/SemaCXX/decltype-pr4448.cpp8
-rw-r--r--test/SemaCXX/default-assignment-operator.cpp74
-rw-r--r--test/SemaCXX/nested-name-spec.cpp23
-rw-r--r--test/SemaCXX/template-specialization.cpp1
-rw-r--r--test/SemaCXX/using-decl-1.cpp8
-rw-r--r--test/SemaCXX/using-decl-pr4441.cpp8
-rw-r--r--test/SemaCXX/using-decl-pr4450.cpp15
11 files changed, 166 insertions, 0 deletions
diff --git a/test/SemaCXX/auto-cxx0x.cpp b/test/SemaCXX/auto-cxx0x.cpp
new file mode 100644
index 000000000000..33156ef23d2e
--- /dev/null
+++ b/test/SemaCXX/auto-cxx0x.cpp
@@ -0,0 +1,5 @@
+// RUN: clang-cc -fsyntax-only -verify %s -std=c++0x
+void f() {
+ auto int a; // expected-error{{cannot combine with previous 'auto' declaration specifier}}
+ int auto b; // expected-error{{cannot combine with previous 'int' declaration specifier}}
+}
diff --git a/test/SemaCXX/auto-cxx98.cpp b/test/SemaCXX/auto-cxx98.cpp
new file mode 100644
index 000000000000..14670cd69942
--- /dev/null
+++ b/test/SemaCXX/auto-cxx98.cpp
@@ -0,0 +1,5 @@
+// RUN: clang-cc -fsyntax-only -verify %s -std=c++98
+void f() {
+ auto int a;
+ int auto b;
+}
diff --git a/test/SemaCXX/basic_lookup_argdep.cpp b/test/SemaCXX/basic_lookup_argdep.cpp
index 486a688d9437..677df8284a72 100644
--- a/test/SemaCXX/basic_lookup_argdep.cpp
+++ b/test/SemaCXX/basic_lookup_argdep.cpp
@@ -58,3 +58,16 @@ namespace M {
void test_operator_name_adl(N::X x) {
(void)operator+(x, x);
}
+
+struct Z { };
+int& f(Z);
+
+namespace O {
+ char &f();
+ void test_global_scope_adl(Z z) {
+ {
+ int& ir = f(z);
+ }
+ }
+}
+
diff --git a/test/SemaCXX/decltype-pr4444.cpp b/test/SemaCXX/decltype-pr4444.cpp
new file mode 100644
index 000000000000..8b2f584d24dd
--- /dev/null
+++ b/test/SemaCXX/decltype-pr4444.cpp
@@ -0,0 +1,6 @@
+// RUN: clang-cc -fsyntax-only -verify %s -std=c++0x
+
+template<typename T, T t>
+struct TestStruct {
+ typedef decltype(t+2) sum_type;
+};
diff --git a/test/SemaCXX/decltype-pr4448.cpp b/test/SemaCXX/decltype-pr4448.cpp
new file mode 100644
index 000000000000..fbf5da1d53ea
--- /dev/null
+++ b/test/SemaCXX/decltype-pr4448.cpp
@@ -0,0 +1,8 @@
+// RUN: clang-cc -fsyntax-only -verify %s -std=c++0x
+
+template< typename T, T t, decltype(t+2) v >
+struct Convoluted {};
+
+int test_array[5];
+
+Convoluted< int *, test_array, nullptr > tarray;
diff --git a/test/SemaCXX/default-assignment-operator.cpp b/test/SemaCXX/default-assignment-operator.cpp
new file mode 100644
index 000000000000..090ba3c3ca80
--- /dev/null
+++ b/test/SemaCXX/default-assignment-operator.cpp
@@ -0,0 +1,74 @@
+// RUN: clang-cc -fsyntax-only -verify %s
+
+class Base { // expected-error {{cannot define the implicit default assignment operator for 'class Base'}} \
+ // expected-note {{synthesized method is first required here}}
+ int &ref; // expected-note {{declared at}}
+};
+
+class X : Base { // // expected-error {{cannot define the implicit default assignment operator for 'class X'}}
+public:
+ X();
+ const int cint; // expected-note {{declared at}}
+};
+
+struct Y : X {
+ Y();
+ Y& operator=(const Y&);
+ Y& operator=(volatile Y&);
+ Y& operator=(const volatile Y&);
+ Y& operator=(Y&);
+};
+
+class Z : Y {};
+
+Z z1;
+Z z2;
+
+// Test1
+void f(X x, const X cx) {
+ x = cx; // expected-note {{synthesized method is first required here}}
+ x = cx;
+ z1 = z2;
+}
+
+// Test2
+class T {};
+T t1;
+T t2;
+
+void g()
+{
+ t1 = t2;
+}
+
+// Test3
+class V {
+public:
+ V();
+ V &operator = (V &b);
+};
+
+class W : V {};
+W w1, w2;
+
+void h()
+{
+ w1 = w2;
+}
+
+// Test4
+
+class B1 {
+public:
+ B1();
+ B1 &operator = (B1 b);
+};
+
+class D1 : B1 {};
+D1 d1, d2;
+
+void i()
+{
+ d1 = d2;
+}
+
diff --git a/test/SemaCXX/nested-name-spec.cpp b/test/SemaCXX/nested-name-spec.cpp
index 4c3ecee09051..8fff8a2b2cbc 100644
--- a/test/SemaCXX/nested-name-spec.cpp
+++ b/test/SemaCXX/nested-name-spec.cpp
@@ -171,3 +171,26 @@ Y::foo y; // expected-error{{incomplete type 'struct Y' named in nested name spe
X::X() : a(5) { } // expected-error{{use of undeclared identifier 'X'}} \
// expected-error{{C++ requires a type specifier for all declarations}} \
// expected-error{{only constructors take base initializers}}
+
+
+
+
+namespace somens {
+ struct a { };
+}
+
+template <typename T>
+class foo {
+};
+
+
+// PR4452
+// FIXME: This error recovery sucks.
+foo<somens:a> a2; // expected-error {{unexpected namespace name 'somens': expected expression}} \
+expected-error {{C++ requires a type specifier for all declarations}}
+
+somens::a a3 = a2;
+
+
+
+
diff --git a/test/SemaCXX/template-specialization.cpp b/test/SemaCXX/template-specialization.cpp
index b3bb08d7e6a2..e23a192d8034 100644
--- a/test/SemaCXX/template-specialization.cpp
+++ b/test/SemaCXX/template-specialization.cpp
@@ -1,4 +1,5 @@
// RUN: clang-cc -fsyntax-only -verify %s
+// XFAIL
template<int N> void f(int (&array)[N]);
template<> void f<1>(int (&array)[1]) { }
diff --git a/test/SemaCXX/using-decl-1.cpp b/test/SemaCXX/using-decl-1.cpp
new file mode 100644
index 000000000000..2459f251deb2
--- /dev/null
+++ b/test/SemaCXX/using-decl-1.cpp
@@ -0,0 +1,8 @@
+// RUN: clang-cc -fsyntax-only -verify %s
+
+extern "C" { void f(bool); }
+
+namespace std {
+ using ::f;
+ inline void f() { return f(true); }
+}
diff --git a/test/SemaCXX/using-decl-pr4441.cpp b/test/SemaCXX/using-decl-pr4441.cpp
new file mode 100644
index 000000000000..6aa2b261e4db
--- /dev/null
+++ b/test/SemaCXX/using-decl-pr4441.cpp
@@ -0,0 +1,8 @@
+// RUN: clang-cc -fsyntax-only -verify %s
+
+namespace A {
+ struct B { };
+ void operator+(B,B);
+}
+
+using A::operator+;
diff --git a/test/SemaCXX/using-decl-pr4450.cpp b/test/SemaCXX/using-decl-pr4450.cpp
new file mode 100644
index 000000000000..c3d5b8300624
--- /dev/null
+++ b/test/SemaCXX/using-decl-pr4450.cpp
@@ -0,0 +1,15 @@
+// RUN: clang-cc -fsyntax-only -verify %s
+
+namespace A {
+ void g();
+}
+
+namespace X {
+ using A::g;
+}
+
+void h()
+{
+ A::g();
+ X::g();
+}