// RUN: %clang_cc1 -fsyntax-only -verify -std=c++2c %s template struct TS; // #template struct Errors { friend int, int; friend int, long, char; // We simply diagnose and ignore the '...' here. friend float...; // expected-error {{pack expansion does not contain any unexpanded parameter packs}} friend short..., unsigned, unsigned short...; // expected-error 2 {{pack expansion does not contain any unexpanded parameter packs}} template friend struct TS, int; // expected-error {{a friend declaration that befriends a template must contain exactly one type-specifier}} double friend; // expected-error {{'friend' must appear first in a non-function declaration}} double friend, double; // expected-error {{expected member name or ';' after declaration specifiers}} }; template struct C { template class Nested; }; template struct D { template class Nested; }; template struct E { template class Nested; }; template // expected-note {{template parameter is declared here}} struct VS { friend Ts...; friend class Ts...; // expected-error {{declaration of 'Ts' shadows template parameter}} // expected-error@-1 {{pack expansion does not contain any unexpanded parameter packs}} // TODO: Fix-it hint to insert '...'. friend Ts; // expected-error {{friend declaration contains unexpanded parameter pack}} template friend Us...; // expected-error {{friend type templates must use an elaborated type}} template // expected-note {{is declared here}} friend class Us...; // expected-error {{declaration of 'Us' shadows template parameter}} template friend class C::template Nested...; // expected-error {{cannot specialize a dependent template}} template friend class C::template Nested...; // expected-error {{cannot specialize a dependent template}} // Nonsense (see CWG 2917). template friend class C::Nested...; // expected-error {{friend declaration expands pack 'Us' that is declared it its own template parameter list}} template friend class E::Nested...; // expected-error {{friend declaration expands pack 'Bs' that is declared it its own template parameter list}} // FIXME: Both of these should be valid, but we can't handle these at // the moment because the NNS is dependent. template friend class TS::Nested...; // expected-warning {{dependent nested name specifier 'TS' for friend template declaration is not supported; ignoring this friend declaration}} template friend class D::Nested...; // expected-warning {{dependent nested name specifier 'D' for friend class declaration is not supported; turning off access control for 'VS'}} }; namespace length_mismatch { struct A { template struct Nested { struct Foo{}; }; }; template struct S { template struct T { // expected-error@+2 {{pack expansion contains parameter packs 'Ts' and 'Us' that have different lengths (1 vs. 2)}} // expected-error@+1 {{pack expansion contains parameter packs 'Ts' and 'Us' that have different lengths (2 vs. 1)}} friend class Ts::template Nested::Foo...; }; }; void f() { S::T s; S::T s2; S::T s3; // expected-note {{in instantiation of}} S::T s4; // expected-note {{in instantiation of}} } }