summaryrefslogtreecommitdiffstats
path: root/test/CXX/class.derived
diff options
context:
space:
mode:
Diffstat (limited to 'test/CXX/class.derived')
-rw-r--r--test/CXX/class.derived/class.abstract/p4.cpp4
-rw-r--r--test/CXX/class.derived/class.abstract/p5.cpp10
-rw-r--r--test/CXX/class.derived/class.member.lookup/p9.cpp28
-rw-r--r--test/CXX/class.derived/class.virtual/p3-0x.cpp53
-rw-r--r--test/CXX/class.derived/p8-0x.cpp22
5 files changed, 110 insertions, 7 deletions
diff --git a/test/CXX/class.derived/class.abstract/p4.cpp b/test/CXX/class.derived/class.abstract/p4.cpp
index ca99bf7..b04de21 100644
--- a/test/CXX/class.derived/class.abstract/p4.cpp
+++ b/test/CXX/class.derived/class.abstract/p4.cpp
@@ -24,7 +24,7 @@ namespace PR6631 {
// subobject but not pure in another subobject.
namespace PartlyPure {
struct A {
- virtual void f() = 0; // expected-note{{pure virtual function}}
+ virtual void f() = 0; // expected-note{{unimplemented pure virtual method}}
};
struct B : A {
@@ -36,7 +36,7 @@ namespace PartlyPure {
struct D : B, C { };
void f() {
- (void) new D; // expected-error{{abstract type}}
+ (void) new D; // expected-error{{abstract class}}
}
}
diff --git a/test/CXX/class.derived/class.abstract/p5.cpp b/test/CXX/class.derived/class.abstract/p5.cpp
index 207519d..cdff931 100644
--- a/test/CXX/class.derived/class.abstract/p5.cpp
+++ b/test/CXX/class.derived/class.abstract/p5.cpp
@@ -1,7 +1,7 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
struct A {
- virtual void f() = 0; // expected-note{{pure virtual function}}
+ virtual void f() = 0; // expected-note{{unimplemented pure virtual method}}
};
struct B : A {
@@ -9,15 +9,15 @@ struct B : A {
};
struct C : B {
- virtual void f() = 0; // expected-note 2{{pure virtual function}}
+ virtual void f() = 0; // expected-note 2{{unimplemented pure virtual method}}
};
struct D : C {
};
void test() {
- (void)new A; // expected-error{{object of abstract type}}
+ (void)new A; // expected-error{{abstract class}}
(void)new B;
- (void)new C; // expected-error{{object of abstract type}}
- (void)new D; // expected-error{{object of abstract type}}
+ (void)new C; // expected-error{{abstract class}}
+ (void)new D; // expected-error{{abstract class}}
}
diff --git a/test/CXX/class.derived/class.member.lookup/p9.cpp b/test/CXX/class.derived/class.member.lookup/p9.cpp
new file mode 100644
index 0000000..ba7bd21
--- /dev/null
+++ b/test/CXX/class.derived/class.member.lookup/p9.cpp
@@ -0,0 +1,28 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+namespace rdar8436162 {
+ class ClsA {
+ public:
+ static void f();
+ void g();
+ };
+
+ class ClsB : virtual private ClsA {
+ public:
+ using ClsA::f;
+ using ClsA::g; // expected-note{{member found by ambiguous name lookup}}
+ };
+
+ class ClsF : virtual private ClsA {
+ public:
+ using ClsA::f;
+ using ClsA::g; // expected-note{{member found by ambiguous name lookup}}
+ };
+
+ class ClsE : public ClsB, public ClsF {
+ void test() {
+ f();
+ g(); // expected-error{{member 'g' found in multiple base classes of different types}}
+ }
+ };
+}
diff --git a/test/CXX/class.derived/class.virtual/p3-0x.cpp b/test/CXX/class.derived/class.virtual/p3-0x.cpp
new file mode 100644
index 0000000..4bd9efd
--- /dev/null
+++ b/test/CXX/class.derived/class.virtual/p3-0x.cpp
@@ -0,0 +1,53 @@
+// RUN: %clang_cc1 -fsyntax-only -std=c++0x -verify %s
+
+namespace Test1 {
+
+struct B {
+ virtual void f(int);
+};
+
+struct D : B {
+ virtual void f(long) override; // expected-error {{'f' marked 'override' but does not override any member functions}}
+ void f(int) override;
+};
+}
+
+namespace Test2 {
+
+struct A {
+ virtual void f(int, char, int);
+};
+
+template<typename T>
+struct B : A {
+ virtual void f(T) override;
+};
+
+}
+
+namespace Test3 {
+
+struct A {
+ virtual void f(int, char, int);
+};
+
+template<typename... Args>
+struct B : A {
+ virtual void f(Args...) override; // expected-error {{'f' marked 'override' but does not override any member functions}}
+};
+
+template struct B<int, char, int>;
+template struct B<int>; // expected-note {{in instantiation of template class 'Test3::B<int>' requested here}}
+
+}
+
+namespace Test4 {
+struct B {
+ virtual void f() const final; // expected-note {{overridden virtual function is here}}
+};
+
+struct D : B {
+ void f() const; // expected-error {{declaration of 'f' overrides a 'final' function}}
+};
+
+}
diff --git a/test/CXX/class.derived/p8-0x.cpp b/test/CXX/class.derived/p8-0x.cpp
new file mode 100644
index 0000000..6a667f7
--- /dev/null
+++ b/test/CXX/class.derived/p8-0x.cpp
@@ -0,0 +1,22 @@
+// RUN: %clang_cc1 %s -fsyntax-only -verify -std=c++0x
+
+namespace Test1 {
+
+struct A {
+ virtual void f(); // expected-note {{overridden virtual function is here}}
+};
+
+struct B explicit : A {
+ virtual void f(); // expected-error {{overrides function without being marked 'override'}}
+};
+
+struct C {
+ virtual ~C();
+};
+
+struct D explicit : C {
+ virtual ~D();
+};
+
+}
+
OpenPOWER on IntegriCloud