// RUN: %clang_cc1 -ffreestanding -Eonly -verify %s
// Try different path permutations of __has_include with existing file.
// Try unary expression.
// Try binary expression.
// Try non-existing file.
// Try defined.
// Try different path permutations of __has_include_next with existing file.
// Try unary expression.
// Try binary expression.
// Try non-existing file.
// Try defined.
// Fun with macros
// Try as non-preprocessor directives
void
MACRO1 // expected-error {{'__has_include' must be used within a preprocessing directive}}
MACRO1 // expected-error {{'__has_include' must be used within a preprocessing directive}}
#elif 1
MACRO1 // expected-error {{'__has_include' must be used within a preprocessing directive}}
MACRO1 // This should be fine because it is never actually reached
// Try badly formed expressions.
// FIXME: We can recover better in almost all of these cases. (PR13335)
// expected-error@+1 {{missing '(' after '__has_include'}}
// expected-error@+1 {{expected "FILENAME" or <FILENAME>}} expected-error@+1 {{token is not a valid binary operator in a preprocessor subexpression}}
// expected-error@+1 {{expected "FILENAME" or <FILENAME>}}
// expected-error@+1 {{missing '(' after '__has_include'}}
// expected-error@+1 {{missing '(' after '__has_include'}}
// expected-error@+1 {{expected "FILENAME" or <FILENAME>}} expected-warning@+1 {{missing terminating '"' character}} expected-error@+1 {{invalid token at start of a preprocessor expression}}
// expected-error@+1 {{expected "FILENAME" or <FILENAME>}} expected-warning@+1 {{missing terminating '"' character}} expected-error@+1 {{token is not a valid binary operator in a preprocessor subexpression}}
// expected-error@+1 {{expected "FILENAME" or <FILENAME>}} expected-error@+1 {{token is not a valid binary operator in a preprocessor subexpression}}
// expected-error@+1 {{'__has_include' must be used within a preprocessing directive}}
__has_include
// expected-error@+1 {{missing ')' after '__has_include'}} // expected-error@+1 {{expected value in expression}} // expected-note@+1 {{to match this '('}}
// expected-error@+1 {{expected "FILENAME" or <FILENAME>}} // expected-error@+1 {{expected value in expression}}
// expected-error@+1 {{missing '(' after '__has_include'}} // expected-error@+1 {{expected value in expression}}
// expected-error@+1 {{missing '(' after '__has_include'}}
// expected-error@+1 {{expected "FILENAME" or <FILENAME>}}
// expected-error@+1 {{expected "FILENAME" or <FILENAME}} expected-error@+1 {{expected end of line in preprocessor expression}}
// expected-error@+1 {{missing ')' after '__has_include'}} // expected-error@+1 {{expected value in expression}} // expected-note@+1 {{to match this '('}}
// expected-error@+1 {{expected '>'}} expected-note@+1 {{to match this '<'}} // expected-error@+1 {{expected value in expression}}
// PR15539