1// bindgen-flags: --with-derive-hash --with-derive-partialeq --with-derive-eq -- -std=c++11 2// 3template<typename T, typename U> class Foo { 4 T m_member; 5 T* m_member_ptr; 6 T m_member_arr[1]; 7}; 8 9template<typename T> class B { 10 T m_member { 0 }; 11}; 12 13void bar(Foo<int, int> foo); 14 15namespace mozilla { 16class Foo; 17}; 18 19struct C { 20 B<unsigned int> mB; 21 B<const int*> mBConstPtr; 22 B<const mozilla::Foo*> mBConstStructPtr; 23 B<const mozilla::Foo*[1]> mBConstStructPtrArray; 24 B<const int> mBConst; 25 B<volatile int> mBVolatile; 26 B<const bool> mBConstBool; 27 B<const char16_t> mBConstChar; 28 B<int[1]> mBArray; 29 B<int*[1]> mBPtrArray; 30 B<int(*)[1]> mBArrayPtr; 31 B<int&> mBRef; 32 B<const int&> mBConstRef; 33 B<int*&> mPtrRef; 34 B<int(&)[1]> mArrayRef; 35 B<const int[1]> mBConstArray; 36}; 37 38template<typename T> 39class D { 40 typedef Foo<int, int> MyFoo; 41 42 MyFoo m_foo; 43 44 template<typename Z> 45 class U { 46 MyFoo m_nested_foo; 47 Z m_baz; 48 }; 49}; 50 51template<typename T> 52class Rooted { 53 T* prev; 54 Rooted<void*>* next; 55 T ptr; 56}; 57 58class RootedContainer { 59 Rooted<void*> root; 60}; 61 62template<typename T> 63class WithDtor; 64 65typedef WithDtor<int> WithDtorIntFwd; 66 67template<typename T> 68class WithDtor { 69 T member; 70 ~WithDtor() {} 71}; 72 73class PODButContainsDtor { 74 WithDtorIntFwd member; 75}; 76 77 78/** <div rustbindgen opaque> */ 79template<typename T> 80class Opaque { 81 T member; 82}; 83 84class POD { 85 Opaque<int> opaque_member; 86}; 87 88/** 89 * <div rustbindgen replaces="NestedReplaced"></div> 90 */ 91template<typename T> 92class Nested { 93 T* buff; 94}; 95 96template<typename T, typename U> 97class NestedBase { 98 T* buff; 99}; 100 101template<typename T> 102class NestedReplaced: public NestedBase<T, int> { 103}; 104 105template<typename T> 106class Incomplete; 107 108template<typename T> 109class NestedContainer { 110 T c; 111private: 112 NestedReplaced<T> nested; 113 Incomplete<T> inc; 114}; 115 116template<typename T> 117class Incomplete { 118 T d; 119}; 120 121class Untemplated {}; 122 123template<typename T> 124class Templated { 125 Untemplated m_untemplated; 126}; 127 128/** 129 * If the replacement doesn't happen at the parse level the container would be 130 * copy and the replacement wouldn't, so this wouldn't compile. 131 * 132 * <div rustbindgen replaces="ReplacedWithoutDestructor"></div> 133 */ 134template<typename T> 135class ReplacedWithDestructor { 136 T* buff; 137 ~ReplacedWithDestructor() {}; 138}; 139 140template<typename T> 141class ReplacedWithoutDestructor { 142 T* buff; 143}; 144 145template<typename T> 146class ReplacedWithoutDestructorFwd; 147 148template<typename T> 149class ShouldNotBeCopiable { 150 ReplacedWithoutDestructor<T> m_member; 151}; 152 153template<typename U> 154class ShouldNotBeCopiableAsWell { 155 ReplacedWithoutDestructorFwd<U> m_member; 156}; 157 158/** 159 * If the replacement doesn't happen at the parse level the container would be 160 * copy and the replacement wouldn't, so this wouldn't compile. 161 * 162 * <div rustbindgen replaces="ReplacedWithoutDestructorFwd"></div> 163 */ 164template<typename T> 165class ReplacedWithDestructorDeclaredAfter { 166 T* buff; 167 ~ReplacedWithDestructorDeclaredAfter() {}; 168}; 169