// RUN: %clang_cc1 -fsyntax-only -std=c++20 -verify %s template struct A { static T cond; template struct B { static T twice(U value) { return (cond ? value + value : value); } }; }; extern template bool A::cond; int foo() { A::cond = true; return A::B::twice(4); } namespace PR6376 { template struct X { template struct Y1 { }; // }; template<> struct X { template struct Y1 { }; }; template struct Z : public X::template Y1 { }; Z z0; } namespace OutOfLine { template struct A { struct B { }; template void f(); template void g() { } // expected-note {{previous definition is here}} template static int x; template static int x; template static inline int x = 0; // expected-note {{previous definition is here}} template struct C; template struct C; template struct C { }; // expected-note {{previous definition is here}} }; template template::B V> void A::f() { } template template::B V> void A::g() { } // expected-error {{redefinition of 'g'}} template template::B V> int A::x = 0; template template::B V> int A::x = 0; template template::B V> int A::x = 0; // expected-error {{redefinition of 'x'}} template template::B V> struct A::C { }; template template::B V> struct A::C { }; template template::B V> struct A::C { }; // expected-error {{redefinition of 'C'}} // FIXME: Crashes when parsing the non-type template parameter prior to C++20 template<> template::B V> void A::f() { } template<> template::B V> void A::g() { } // expected-note {{previous definition is here}} template<> template::B V> void A::g() { } // expected-error {{redefinition of 'g'}} template<> template::B V> int A::x = 0; template<> template::B V> int A::x = 0; template<> template::B V> int A::x = 0; // expected-note {{previous definition is here}} template<> template::B V> int A::x = 0; // expected-error {{redefinition of 'x'}} template<> template::B V> struct A::C { }; template<> template::B V> struct A::C { }; template<> template::B V> struct A::C { }; // expected-note {{previous definition is here}} template<> template::B V> struct A::C { }; // expected-error {{redefinition of 'C'}} }