1 // RUN:  %clang_cc1 -std=c++2a -verify %s
2 
3 template<typename T>
4 class A {
5   virtual void f1() requires (sizeof(T) == 0);
6   // expected-error@-1{{virtual function cannot have a requires clause}}
7   virtual void f2() requires (sizeof(T) == 1);
8   // expected-error@-1{{virtual function cannot have a requires clause}}
9 };
10 
11 template<typename T>
12 class B : A<T> {
f1()13   virtual void f1() requires (sizeof(T) == 0) override {}
14   // expected-error@-1{{virtual function cannot have a requires clause}}
15 };
16 
17 template<typename T> struct C : T {void f() requires true; };
18 // expected-error@-1{{virtual function cannot have a requires clause}}
19 struct D { virtual void f(); };
20 template struct C<D>;
21 // expected-note@-1{{in instantiation of template class 'C<D>' requested here}}