Lines Matching defs:base
658 struct Base : Bottom {
659 constexpr Base(int a = 42, const char *b = "test") : a(a), b(b) {}
668 struct Derived : Base, Base2 {
669 constexpr Derived() : Base(76), Base2(a) {}
673 constexpr bool operator==(const Base &a, const Base &b) {
677 constexpr Base base;
678 constexpr Base base2(76);
687 static_assert(!(derived == base), "");
690 constexpr Bottom &bot1 = (Base&)derived;
694 constexpr Bottom *pb1 = (Base*)&derived;
701 constexpr Base &fail2 = (Base&)*pb2; // expected-error {{constant expression}} expected-note {{cannot cast object of dynamic type 'const Class::Derived' to type 'Class::Base'}}
706 constexpr Base *pfail2 = (Base*)&bot2; // expected-error {{constant expression}} expected-note {{cannot cast object of dynamic type 'const Class::Derived' to type 'Class::Base'}}
710 static_assert((Base2*)(Derived*)(Base*)pb1 == pok2, "");
711 static_assert((Derived*)(Base*)pb1 == (Derived*)pok2, "");
713 constexpr Base *nullB = 42 - 6 * 7; // expected-warning {{expression which evaluates to zero treated as a null pointer constant of type 'Class::Base *const'}}
717 Base * nullB2 = '\0'; // expected-warning {{expression which evaluates to zero treated as a null pointer constant of type 'Class::Base *'}}
718 Base * nullB3 = (0);
765 // T full-object via a base-to-derived cast, or a derived-to-base-casted member
909 struct Base { int n; };
910 template<int N> struct Mid : Base {};
915 static_assert(&Mid<0>::n == (int Mid<0>::*)&Base::n, "");
920 struct Base {
921 constexpr Base() {}
924 struct Derived : Base {
931 constexpr Base *pb3 = const_cast<Derived*>(&a[3]);
935 constexpr Base *pb4 = pb3 + 1; // ok, one-past-the-end pointer.
937 constexpr Base *err_pb5 = pb3 + 2; // expected-error {{constant expression}} expected-note {{cannot refer to element 2}} expected-note {{here}}
939 constexpr Base *err_pb2 = pb3 - 1; // expected-error {{constant expression}} expected-note {{cannot refer to element -1}} expected-note {{here}}
941 constexpr Base *pb3a = pb4 - 1;
954 constexpr int err_pd10n = pd10->n; // expected-error {{constant expression}} expected-note {{cannot access base class of pointer past the end}}
958 constexpr Base *pb9 = pd9;
959 constexpr const int *(Base::*pfb)() const =
960 static_cast<const int *(Base::*)() const>(&Derived::f);