void set(TT position, double value) { // CHECK-SETTER: File 0, [[@LINE]]:39 -> [[@LINE+2]]:4 = #0 bases[position] = value; } }; class Test2 { // CHECK-CONSTRUCTOR: _ZN5Test2C Test2() { } // CHECK-CONSTRUCTOR: File 0, [[@LINE]]:11 -> [[@LINE]]:14 = 0 // CHECK-GETTER: _ZNK5Test23get double get(unsigned position) const { // CHECK-GETTER: File 0, [[@LINE]]:39 -> [[@LINE+2]]:4 = 0 return 0.0; } }; // Test3::unmangleable can't be mangled, since there isn't a complete type for // the __is_final type trait expression. This would cause errors if we try to // emit a no-coverage mapping for the method. template <class T, bool = __is_final(T)> class UninstantiatedClassWithTraits {}; template <class T> class Test3 { void unmangleable(UninstantiatedClassWithTraits<T> x) {} }; int main() { Test<unsigned> t; t.set(Test<unsigned>::A, 5.5); t.set(Test<unsigned>::T, 5.6); t.set(Test<unsigned>::G, 5.7); t.set(Test<unsigned>::C, 5.8); return 0; }
// PR c++/51365 // { dg-do compile } // { dg-options "-std=c++0x" } struct A { }; static_assert( ! __is_final (A), "A not final" ); struct Af final { }; static_assert( __is_final (Af), "Af is final" ); class B { }; static_assert( ! __is_final (B), "B not final" ); class Bf final { }; static_assert( __is_final (Bf), "Bf is final" ); struct C : private A, private B { }; static_assert( ! __is_final (C), "C not final" ); struct Cf final : private A, private B { }; static_assert( __is_final (Cf), "Cf is final" ); struct D { virtual ~D() final { } }; static_assert( ! __is_final (D), "D not final" ); struct Df final { virtual ~Df() final { } }; static_assert( __is_final (Df), "Df is final" ); template<typename> struct E { }; static_assert( ! __is_final (E<int>), "E<int> not final" ); static_assert( ! __is_final (E<Af>), "E<Af> not final" );
concept bool Final() { return __is_final(T); }
class DefaultDeleter<T[]> { constexpr DefaultDeleter() = default; constexpr DefaultDeleter(const DefaultDeleter&) = default; void operator()(T* ptr) const { static_assert(sizeof(T) > 0, "Can't delete incomplete type"); delete[] ptr; } }; /* * UniquePointer members are stored in this seperate class in order to employ * empty base class optimization for the deleter object (so that empty deleters * have no memory overhead). */ template<class T, class Deleter, bool = __is_empty(Deleter) && !__is_final(Deleter)> class UniquePointerData : private Deleter { public: UniquePointerData(T* ptr, Deleter deleter) : Deleter(deleter), pointer(ptr) { } T*& ptr() { return pointer; } const T*& ptr() const { return pointer; } Deleter& deleter() { return *this; } const Deleter& deleter() const { return *this; } private: T* pointer; }; template<class T, class Deleter>