aboutsummaryrefslogtreecommitdiff
path: root/test/SemaCXX/abstract.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/SemaCXX/abstract.cpp')
-rw-r--r--test/SemaCXX/abstract.cpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/test/SemaCXX/abstract.cpp b/test/SemaCXX/abstract.cpp
new file mode 100644
index 0000000000..a7a52116da
--- /dev/null
+++ b/test/SemaCXX/abstract.cpp
@@ -0,0 +1,26 @@
+// RUN: clang -fsyntax-only -verify %s -std=c++0x
+
+#ifndef __GXX_EXPERIMENTAL_CXX0X__
+#define __CONCAT(__X, __Y) __CONCAT1(__X, __Y)
+#define __CONCAT1(__X, __Y) __X ## __Y
+
+#define static_assert(__b, __m) \
+ typedef int __CONCAT(__sa, __LINE__)[__b ? 1 : -1]
+#endif
+
+class C {
+ virtual void f() = 0;
+};
+
+static_assert(__is_abstract(C), "C has a pure virtual function");
+
+class D : C {
+};
+
+static_assert(__is_abstract(D), "D inherits from an abstract class");
+
+class E : D {
+ virtual void f();
+};
+
+static_assert(!__is_abstract(E), "E inherits from an abstract class but implements f");