// RUN: %clang_cc1 -std=c++2a -x c++ %s -verify
// RUN: %clang_cc1 -std=c++2b -x c++ %s -verify
// Test parsing of the optional requires-clause in a template-declaration.
requires
struct A ;
void
struct A<T>::AA ;
enum A<T>::E : int ;
int A<T>::x = 0;
requires <T>
requires <T>::M ;
requires <T>::Mx = 0;
requires = 0;
requires = A<T>;
;
requires
requires ;
requires = 0;
// Test behavior with non-primary-expression requires clauses
requires ;
int
requires ;
struct B3 ;
requires T
// expected-error@-1{{parentheses are required around this expression in a requires clause}}
;
requires sizeof == 0
// expected-error@-1{{parentheses are required around this expression in a requires clause}}
;
== 0
// expected-error@-1{{parentheses are required around this expression in a requires clause}}
;
requires 0
// expected-error@-1{{atomic constraint must be of type 'bool' (found 'int')}}
;
requires ;
// expected-error@-1{{expected '(' for function-style cast or type construction}}
void requires foo<T>;
// expected-error@-1{{parentheses are required around this expression in a requires clause}}
void ;
void requires ;
// expected-error@-1{{atomic constraint must be of type 'bool' (found '<overloaded function type>')}}
// expected-note@-2{{parentheses are required around this expression in a requires clause}}
void requires T;
// expected-error@-1{{parentheses are required around this expression in a requires clause}}
void requires sizeof == 0;
// expected-error@-1{{parentheses are required around this expression in a requires clause}}
void == 0;
// expected-error@-1{{parentheses are required around this expression in a requires clause}}
void ;
;
auto lambda1 = ;
auto lambda2 = constexpr -> int ;
auto lambda3 = <auto> ;
auto lambda4 = ; // expected-error {{expected body of lambda expression}}
// expected-warning@-2{{lambda without a parameter clause is a C++2b extension}}