1748945ec6f1c67b7efc934ab0808e1d32f2fb98dDaniel Erat// RUN: %clang_cc1 -std=c++14 -fconcepts-ts -fcxx-exceptions -x c++ -verify %s 2748945ec6f1c67b7efc934ab0808e1d32f2fb98dDaniel Erat 3748945ec6f1c67b7efc934ab0808e1d32f2fb98dDaniel Eratnamespace A { 4748945ec6f1c67b7efc934ab0808e1d32f2fb98dDaniel Erat template<typename T> concept bool C1() { return true; } 5748945ec6f1c67b7efc934ab0808e1d32f2fb98dDaniel Erat 6748945ec6f1c67b7efc934ab0808e1d32f2fb98dDaniel Erat template<typename T> concept bool C2 = true; 7748945ec6f1c67b7efc934ab0808e1d32f2fb98dDaniel Erat} 8748945ec6f1c67b7efc934ab0808e1d32f2fb98dDaniel Erat 9748945ec6f1c67b7efc934ab0808e1d32f2fb98dDaniel Erattemplate<typename T> concept bool C3() { return (throw 0, true); } 10748945ec6f1c67b7efc934ab0808e1d32f2fb98dDaniel Eratstatic_assert(noexcept(C3<int>()), "function concept should be treated as if noexcept(true) specified"); 11748945ec6f1c67b7efc934ab0808e1d32f2fb98dDaniel Erat 12748945ec6f1c67b7efc934ab0808e1d32f2fb98dDaniel Erattemplate<typename T> concept bool D1(); // expected-error {{function concept declaration must be a definition}} 13748945ec6f1c67b7efc934ab0808e1d32f2fb98dDaniel Erat 14748945ec6f1c67b7efc934ab0808e1d32f2fb98dDaniel Eratstruct B { 15748945ec6f1c67b7efc934ab0808e1d32f2fb98dDaniel Erat template<typename T> concept bool D2() { return true; } // expected-error {{concept declarations may only appear in namespace scope}} 16748945ec6f1c67b7efc934ab0808e1d32f2fb98dDaniel Erat}; 17748945ec6f1c67b7efc934ab0808e1d32f2fb98dDaniel Erat 18748945ec6f1c67b7efc934ab0808e1d32f2fb98dDaniel Eratstruct C { 19748945ec6f1c67b7efc934ab0808e1d32f2fb98dDaniel Erat template<typename T> static concept bool D3 = true; // expected-error {{concept declarations may only appear in namespace scope}} 20748945ec6f1c67b7efc934ab0808e1d32f2fb98dDaniel Erat}; 21748945ec6f1c67b7efc934ab0808e1d32f2fb98dDaniel Erat 22748945ec6f1c67b7efc934ab0808e1d32f2fb98dDaniel Eratconcept bool D4() { return true; } // expected-error {{'concept' can only appear on the definition of a function template or variable template}} 23748945ec6f1c67b7efc934ab0808e1d32f2fb98dDaniel Erat 24748945ec6f1c67b7efc934ab0808e1d32f2fb98dDaniel Eratconcept bool D5 = true; // expected-error {{'concept' can only appear on the definition of a function template or variable template}} 25748945ec6f1c67b7efc934ab0808e1d32f2fb98dDaniel Erat 26748945ec6f1c67b7efc934ab0808e1d32f2fb98dDaniel Erattemplate<typename T> 27748945ec6f1c67b7efc934ab0808e1d32f2fb98dDaniel Eratconcept bool D6; // expected-error {{variable concept declaration must be initialized}} 28748945ec6f1c67b7efc934ab0808e1d32f2fb98dDaniel Erat 29748945ec6f1c67b7efc934ab0808e1d32f2fb98dDaniel Erattemplate<typename T> 30748945ec6f1c67b7efc934ab0808e1d32f2fb98dDaniel Eratconcept bool D7() throw(int) { return true; } // expected-error {{function concept cannot have exception specification}} 31748945ec6f1c67b7efc934ab0808e1d32f2fb98dDaniel Erat 32748945ec6f1c67b7efc934ab0808e1d32f2fb98dDaniel Erat// Tag 33748945ec6f1c67b7efc934ab0808e1d32f2fb98dDaniel Eratconcept class CC1 {}; // expected-error {{'concept' can only appear on the definition of a function template or variable template}} 34748945ec6f1c67b7efc934ab0808e1d32f2fb98dDaniel Eratconcept struct CS1 {}; // expected-error {{'concept' can only appear on the definition of a function template or variable template}} 35748945ec6f1c67b7efc934ab0808e1d32f2fb98dDaniel Eratconcept union CU1 {}; // expected-error {{'concept' can only appear on the definition of a function template or variable template}} 36748945ec6f1c67b7efc934ab0808e1d32f2fb98dDaniel Eratconcept enum CE1 {}; // expected-error {{'concept' can only appear on the definition of a function template or variable template}} 37748945ec6f1c67b7efc934ab0808e1d32f2fb98dDaniel Erattemplate <typename T> concept class TCC1 {}; // expected-error {{'concept' can only appear on the definition of a function template or variable template}} 38748945ec6f1c67b7efc934ab0808e1d32f2fb98dDaniel Erattemplate <typename T> concept struct TCS1 {}; // expected-error {{'concept' can only appear on the definition of a function template or variable template}} 39748945ec6f1c67b7efc934ab0808e1d32f2fb98dDaniel Erattemplate <typename T> concept union TCU1 {}; // expected-error {{'concept' can only appear on the definition of a function template or variable template}} 40748945ec6f1c67b7efc934ab0808e1d32f2fb98dDaniel Erattypedef concept int CI; // expected-error {{'concept' can only appear on the definition of a function template or variable template}} 41748945ec6f1c67b7efc934ab0808e1d32f2fb98dDaniel Eratvoid fpc(concept int i) {} // expected-error {{'concept' can only appear on the definition of a function template or variable template}} 42748945ec6f1c67b7efc934ab0808e1d32f2fb98dDaniel Erat 43748945ec6f1c67b7efc934ab0808e1d32f2fb98dDaniel Eratconcept bool; // expected-error {{'concept' can only appear on the definition of a function template or variable template}} 44748945ec6f1c67b7efc934ab0808e1d32f2fb98dDaniel Erat