diff options
author | Anders Carlsson <andersca@mac.com> | 2009-03-22 01:52:17 +0000 |
---|---|---|
committer | Anders Carlsson <andersca@mac.com> | 2009-03-22 01:52:17 +0000 |
commit | 7cbd8fb6b0c1bba7fdcf7a8f86c1b15f2837e322 (patch) | |
tree | 0f9bffe574ebe2d8dc6a8e4c0e4bc8980864cc4e /clang/test/SemaCXX/abstract.cpp | |
parent | e09ad90882f5bb2777f9446447105f58888f7416 (diff) | |
download | bcm5719-llvm-7cbd8fb6b0c1bba7fdcf7a8f86c1b15f2837e322.tar.gz bcm5719-llvm-7cbd8fb6b0c1bba7fdcf7a8f86c1b15f2837e322.zip |
Keep track of whether a class is abstract or not. This is currently only used for the __is_abstract type trait.
llvm-svn: 67461
Diffstat (limited to 'clang/test/SemaCXX/abstract.cpp')
-rw-r--r-- | clang/test/SemaCXX/abstract.cpp | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/clang/test/SemaCXX/abstract.cpp b/clang/test/SemaCXX/abstract.cpp new file mode 100644 index 00000000000..a7a52116da8 --- /dev/null +++ b/clang/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"); |