1// RUN: %clang_cc1 -std=c++14 -fconcepts-ts -x c++ %s -verify 2 3// Test parsing of constraint-expressions in cases where the grammar is 4// ambiguous with the expectation that the longest token sequence which matches 5// the syntax is consumed without backtracking. 6 7// type-specifier-seq in conversion-type-id 8template <typename T> requires (bool)&T::operator short 9unsigned int foo(); // expected-error {{C++ requires a type specifier for all declarations}} 10 11// type-specifier-seq in new-type-id 12template <typename T> requires (bool)sizeof new (T::f()) short 13unsigned int bar(); // expected-error {{C++ requires a type specifier for all declarations}} 14 15template<typename T> requires (bool)sizeof new (T::f()) unsigned // expected-error {{'struct' cannot be signed or unsigned}} 16struct X { }; // expected-error {{'X' cannot be defined in a type specifier}} 17 18// C-style cast 19// of function call on function-style cast 20template <typename T> requires (bool(T())) 21T (*fp)(); // expected-error {{use of undeclared identifier 'fp'}} 22 23// function-style cast 24// as the callee in a function call 25struct A { 26 static int t; 27 template <typename T> requires bool(T()) 28 (A(T (&t))) { } // expected-error {{called object type 'bool' is not a function or function pointer}} 29}; 30