================ @@ -41,6 +42,141 @@ namespace cwg202 { // cwg202: 3.1 template struct X<f>; } +namespace cwg203 { // cwg203: 3.0 +namespace ex1 { +struct B { + int i; +}; +struct D1 : B {}; +struct D2 : B {}; + +int(D1::*pmD1) = &D2::i; +} // namespace ex1 + +#if __cplusplus >= 202002L +namespace ex2 { +struct A { + int i; + virtual void f() = 0; // #cwg203-ex2-A-f +}; + +struct B : A { + int j; + constexpr B() : j(5) {} + virtual void f(); +}; + +struct C : B { + constexpr C() { j = 10; } +}; + +template <class T> +constexpr int DefaultValue(int(T::*m)) { + return T().*m; + // since-cxx20-error@-1 {{allocating an object of abstract class type 'cwg203::ex2::A'}} + // since-cxx20-note@#cwg203-ex2-a {{in instantiation of function template specialization 'cwg203::ex2::DefaultValue<cwg203::ex2::A>' requested here}} + // since-cxx20-note@#cwg203-ex2-A-f {{unimplemented pure virtual method 'f' in 'A'}} +} // #cwg203-ex2-DefaultValue + +int a = DefaultValue(&B::i); // #cwg203-ex2-a +static_assert(DefaultValue(&C::j) == 5, ""); ---------------- Endilll wrote:
There are only 10 cases of C++17-style static_assert through C++ DR tests, so I'd like to remain consistent. https://github.com/llvm/llvm-project/pull/121687 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits