summaryrefslogtreecommitdiffstats
path: root/test/SemaCXX/abstract.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/SemaCXX/abstract.cpp')
-rw-r--r--test/SemaCXX/abstract.cpp36
1 files changed, 35 insertions, 1 deletions
diff --git a/test/SemaCXX/abstract.cpp b/test/SemaCXX/abstract.cpp
index e20a890..d7e2d0a 100644
--- a/test/SemaCXX/abstract.cpp
+++ b/test/SemaCXX/abstract.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++11
+// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++11 -Wabstract-vbase-init
#ifndef __GXX_EXPERIMENTAL_CXX0X__
#define __CONCAT(__X, __Y) __CONCAT1(__X, __Y)
@@ -250,6 +250,13 @@ namespace test4 {
};
}
+namespace test5 {
+ struct A { A(int); virtual ~A() = 0; }; // expected-note {{pure virtual method}}
+ const A &a = 0; // expected-error {{abstract class}}
+ void f(const A &a = 0); // expected-error {{abstract class}}
+ void g() { f(0); } // expected-error {{abstract class}}
+}
+
// PR9247: Crash on invalid in clang::Sema::ActOnFinishCXXMemberSpecification
namespace pr9247 {
struct A {
@@ -273,3 +280,30 @@ namespace pr12658 {
foo(C(99)); // expected-error {{allocating an object of abstract class type 'pr12658::C'}}
}
}
+
+namespace pr16659 {
+ struct A {
+ A(int);
+ virtual void x() = 0; // expected-note {{unimplemented pure virtual method 'x' in 'RedundantInit'}}
+ };
+ struct B : virtual A {};
+ struct C : B {
+ C() : A(37) {}
+ void x() override {}
+ };
+
+ struct X {
+ friend class Z;
+ private:
+ X &operator=(const X&);
+ };
+ struct Y : virtual X { // expected-note {{::X' has an inaccessible copy assignment}}
+ virtual ~Y() = 0;
+ };
+ struct Z : Y {}; // expected-note {{::Y' has a deleted copy assignment}}
+ void f(Z &a, const Z &b) { a = b; } // expected-error {{copy assignment operator is implicitly deleted}}
+
+ struct RedundantInit : virtual A {
+ RedundantInit() : A(0) {} // expected-warning {{initializer for virtual base class 'pr16659::A' of abstract class 'RedundantInit' will never be used}}
+ };
+}
OpenPOWER on IntegriCloud