1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116
|
// RUN: %clang_cc1 %s -fsyntax-only -verify
namespace CurrentInstantiation {
template<typename T>
struct A0 { // expected-note 6{{definition of 'A0<T>' is not complete until the closing '}'}}
struct B0 : A0 { }; // expected-error {{base class has incomplete type}}
template<typename U>
struct B1 : A0 { }; // expected-error {{base class has incomplete type}}
struct B2;
template<typename U>
struct B3;
struct B4 { // expected-note 2{{definition of 'CurrentInstantiation::A0::B4' is not complete until the closing '}'}}
struct C0 : A0, B4 { }; // expected-error 2{{base class has incomplete type}}
template<typename V>
struct C1 : A0, B4 { }; // expected-error 2{{base class has incomplete type}}
struct C2;
template<typename V>
struct C3;
};
template<typename U>
struct B5 { // expected-note 2{{definition of 'B5<U>' is not complete until the closing '}'}}
struct C0 : A0, B5 { }; // expected-error 2{{base class has incomplete type}}
template<typename V>
struct C1 : A0, B5 { }; // expected-error 2{{base class has incomplete type}}
struct C2;
template<typename V>
struct C3;
};
};
template<typename T>
struct A0<T>::B2 : A0 { };
template<typename T>
template<typename U>
struct A0<T>::B3 : A0 { };
template<typename T>
struct A0<T>::B4::C2 : A0, B4 { };
template<typename T>
template<typename V>
struct A0<T>::B4::C3 : A0, B4 { };
template<typename T>
template<typename U>
struct A0<T>::B5<U>::C2 : A0, B5 { };
template<typename T>
template<typename U>
template<typename V>
struct A0<T>::B5<U>::C3 : A0, B5 { };
template<typename T>
struct A0<T*> { // expected-note 2{{definition of 'A0<type-parameter-0-0 *>' is not complete until the closing '}'}}
struct B0 : A0 { }; // expected-error {{base class has incomplete type}}
template<typename U>
struct B1 : A0 { }; // expected-error {{base class has incomplete type}}
struct B2;
template<typename U>
struct B3;
};
template<typename T>
struct A0<T*>::B2 : A0 { };
template<typename T>
template<typename U>
struct A0<T*>::B3 : A0 { };
} // namespace CurrentInstantiation
namespace MemberOfCurrentInstantiation {
template<typename T>
struct A0 {
struct B : B { }; // expected-error {{base class has incomplete type}}
// expected-note@-1 {{definition of 'MemberOfCurrentInstantiation::A0::B' is not complete until the closing '}'}}
template<typename U>
struct C : C<U> { }; // expected-error {{base class has incomplete type}}
// expected-note@-1 {{definition of 'C<U>' is not complete until the closing '}'}}
};
template<typename T>
struct A1 {
struct B; // expected-note {{definition of 'MemberOfCurrentInstantiation::A1<long>::B' is not complete until the closing '}'}}
struct C : B { }; // expected-error {{base class has incomplete type}}
struct B : C { }; // expected-note {{in instantiation of member class 'MemberOfCurrentInstantiation::A1<long>::C' requested here}}
};
template struct A1<long>; // expected-note {{in instantiation of member class 'MemberOfCurrentInstantiation::A1<long>::B' requested here}}
template<>
struct A1<short>::B {
static constexpr bool f() {
return true;
}
};
static_assert(A1<short>::C::f());
} // namespace MemberOfCurrentInstantiation
|