1 | //-*- C++ -*- |
2 | |
3 | // Intended to exercise all syntactic parts of the C++ language that |
4 | // aren't part of C. |
5 | |
6 | namespace std { |
7 | namespace debug { |
8 | } |
9 | } |
10 | |
11 | using namespace std::debug; |
12 | using namespace std; |
13 | |
14 | namespace safestl = ::std::debug; |
15 | |
16 | class Base1 { |
17 | }; |
18 | |
19 | class Base2 { }; |
20 | |
21 | class Derived1 : Base1, virtual public Base2 { }; |
22 | |
23 | /* Template classes, template functions */ |
24 | enum E1 { EC1 }; |
25 | template <E1 v> class C1 {}; |
26 | template <E1 v> C1<v> f1() { return C1<v>(); } |
27 | void f2() { f1<EC1>(); } |
28 | |
29 | // Friend declarations |
30 | struct FriendlyStruct { |
31 | friend bool operator==(FriendlyStruct, FriendlyStruct) { return true; } |
32 | friend struct FriendedStruct; |
33 | }; |
34 | |
35 | struct FriendedStruct { }; |
36 | |
37 | // Using declaration |
38 | namespace provider { |
39 | void foo(); |
40 | } |
41 | namespace user { |
42 | using provider::foo; |
43 | } |
44 | |
45 | // Empty declaration |
46 | ; |
47 | |
48 | // Template specialization declarations |
49 | template<typename T> class ClassTemplateSpecialization; |
50 | |
51 | template<> |
52 | class ClassTemplateSpecialization<bool> { }; |
53 | |
54 | template<typename T, bool> struct ClassTemplatePartialSpecialization; |
55 | |
56 | template<typename T> |
57 | struct ClassTemplatePartialSpecialization<T, true> { }; |
58 | |
59 | // Access specifier |
60 | struct AccessSpec { |
61 | private: |
62 | }; |
63 | |
64 | // Variable template |
65 | template <typename T> T varTemplate = 0; |
66 | |
67 | static_assert(true, ""); |
68 | |