// RUN: %clang_cc1 -std=c++2a -x c++ %s -verify template constexpr bool is_same_v = false; template constexpr bool is_same_v = true; template struct identity { using type = T; }; template using identity_t = T; // Type requirements template requires requires { typename identity_t; } struct r1; template requires requires { typename identity_t; } // expected-note{{previous template declaration is here}} struct r1; template requires requires { typename identity_t; } // expected-error{{requires clause differs in template redeclaration}} struct r1; template requires requires { typename ::identity_t; } struct r1; template requires requires { typename identity::type; } struct r2; template requires requires { typename identity::type; } struct r2; template requires requires { typename ::identity::type; } // expected-note 2{{previous template declaration is here}} struct r2; template requires requires { typename identity::typr; } // expected-error{{requires clause differs in template redeclaration}} struct r2; namespace ns { template struct identity { using type = T; }; } template requires requires { typename ns::identity::type; } // expected-error{{requires clause differs in template redeclaration}} struct r2; template requires requires { typename T::template identity::type; } struct r3; template requires requires { typename U::template identity::type; } // expected-note{{previous template declaration is here}} struct r3; template requires requires { typename T::template identitr::type; } // expected-error{{requires clause differs in template redeclaration}} struct r3; template requires requires { typename T::template temp<>; } struct r4; template requires requires { typename U::template temp<>; } struct r4; // Expr requirements template requires requires { 0; } // expected-note{{previous template declaration is here}} struct r5; template requires requires { 1; } // expected-error{{requires clause differs in template redeclaration}} struct r5; template concept C1 = true; template requires requires { sizeof(T); } struct r6; template requires requires { sizeof(U); } // expected-note{{previous template declaration is here}} struct r6; template requires requires { sizeof(U) - 1; } // expected-error{{requires clause differs in template redeclaration}} struct r6; template requires requires { { sizeof(T) }; } // expected-note 2{{previous template declaration is here}} struct r6; template requires requires { { sizeof(T) } noexcept; } // expected-error{{requires clause differs in template redeclaration}} struct r6; template requires requires { { sizeof(T) } -> C1; } // expected-error{{requires clause differs in template redeclaration}} struct r6; template requires requires { { sizeof(T) } -> C1; } struct r7; template requires requires { { sizeof(U) } -> C1; } struct r7; template requires requires { { sizeof(T) } -> C1<>; } // expected-note {{previous template declaration is here}} struct r7; template requires requires { { sizeof(U) }; } // expected-error{{requires clause differs in template redeclaration}} struct r7; template concept C2 = true; template requires requires { { sizeof(T) } -> C2; } struct r8; template requires requires { { sizeof(U) } -> C2; } // expected-note{{previous template declaration is here}} struct r8; template requires requires { { sizeof(T) } -> C2; } // expected-error{{requires clause differs in template redeclaration}} struct r8; // Nested requirements template requires requires { requires sizeof(T) == 0; } struct r9; template requires requires { requires sizeof(U) == 0; } // expected-note{{previous template declaration is here}} struct r9; template requires requires { requires sizeof(T) == 1; } // expected-error{{requires clause differs in template redeclaration}} struct r9; // Parameter list template requires requires { requires true; } struct r10; template requires requires() { requires true; } // expected-note{{previous template declaration is here}} struct r10; template requires requires(T i) { requires true; } // expected-error{{requires clause differs in template redeclaration}} struct r10; template requires requires(T i, T *j) { requires true; } // expected-note 2{{previous template declaration is here}} struct r11; template requires requires(T i) { requires true; } // expected-error{{requires clause differs in template redeclaration}} struct r11; template requires requires(T i, T *j, T &k) { requires true; } // expected-error{{requires clause differs in template redeclaration}} struct r11; // Parameter names template requires requires(int i) { requires sizeof(i) == 1; } struct r12; template requires requires(int j) { requires sizeof(j) == 1; } // expected-note 2{{previous template declaration is here}} struct r12; template requires requires(int k) { requires sizeof(k) == 2; } // expected-error{{requires clause differs in template redeclaration}} struct r12; template requires requires(const int k) { requires sizeof(k) == 1; } // expected-error{{requires clause differs in template redeclaration}} struct r12; // Order of requirements template requires requires { requires true; 0; } struct r13; template requires requires { requires true; 0; } // expected-note{{previous template declaration is here}} struct r13; template requires requires { 0; requires true; } // expected-error{{requires clause differs in template redeclaration}} struct r13;