1 // RUN: %clang_cc1 -verify %s -std=c++20
3 // We avoid printing the name of an inline namespace unless it's necessary to
4 // uniquely identify the target.
10 struct f
; struct g
; struct h
; struct i
; struct j
;
20 template<int*> struct Q
; // expected-note 5{{here}}
21 Q
<&A::B::C::f
> q1
; // expected-error {{implicit instantiation of undefined template 'N::Q<&N::f>'}}
22 Q
<&A::B::C::g
> q2
; // expected-error {{implicit instantiation of undefined template 'N::Q<&N::C::g>'}}
23 Q
<&A::B::C::h
> q3
; // expected-error {{implicit instantiation of undefined template 'N::Q<&N::B::h>'}}
24 Q
<&A::B::C::i
> q4
; // expected-error {{implicit instantiation of undefined template 'N::Q<&N::A::i>'}}
25 Q
<&A::B::C::j
> q5
; // expected-error {{implicit instantiation of undefined template 'N::Q<&N::C::j>'}}
27 template<typename
> struct R
; // expected-note 5{{here}}
28 R
<struct A::B::C::f
> r1
; // expected-error {{implicit instantiation of undefined template 'N::R<N::f>'}}
29 R
<struct A::B::C::g
> r2
; // expected-error {{implicit instantiation of undefined template 'N::R<N::C::g>'}}
30 R
<struct A::B::C::h
> r3
; // expected-error {{implicit instantiation of undefined template 'N::R<N::B::h>'}}
31 R
<struct A::B::C::i
> r4
; // expected-error {{implicit instantiation of undefined template 'N::R<N::A::i>'}}
32 R
<struct A::B::C::j
> r5
; // expected-error {{implicit instantiation of undefined template 'N::R<N::C::j>'}}
34 // Make the name N::C ambiguous.
35 inline namespace A
{ int C
; }
37 template<int*> struct S
; // expected-note 5{{here}}
38 S
<&A::B::C::f
> s1
; // expected-error {{implicit instantiation of undefined template 'N::S<&N::f>'}}
39 S
<&A::B::C::g
> s2
; // expected-error {{implicit instantiation of undefined template 'N::S<&N::B::C::g>'}}
40 S
<&A::B::C::h
> s3
; // expected-error {{implicit instantiation of undefined template 'N::S<&N::B::h>'}}
41 S
<&A::B::C::i
> s4
; // expected-error {{implicit instantiation of undefined template 'N::S<&N::A::i>'}}
42 S
<&A::B::C::j
> s5
; // expected-error {{implicit instantiation of undefined template 'N::S<&N::B::C::j>'}}
44 template<typename
> struct T
; // expected-note 5{{here}}
45 T
<struct A::B::C::f
> t1
; // expected-error {{implicit instantiation of undefined template 'N::T<N::f>'}}
46 T
<struct A::B::C::g
> t2
; // expected-error {{implicit instantiation of undefined template 'N::T<N::B::C::g>'}}
47 T
<struct A::B::C::h
> t3
; // expected-error {{implicit instantiation of undefined template 'N::T<N::B::h>'}}
48 T
<struct A::B::C::i
> t4
; // expected-error {{implicit instantiation of undefined template 'N::T<N::A::i>'}}
49 T
<struct A::B::C::j
> t5
; // expected-error {{implicit instantiation of undefined template 'N::T<N::B::C::j>'}}
52 namespace dont_crash
{
53 // A malformed lookup involving inline namespaces in a linkage specification
54 // would previous cause an assertion due to the way diagnostics are emitted.
55 extern "C++" inline namespace {
57 a
: b
// expected-error {{unexpected ':' in nested name specifier; did you mean '::'?}} \
58 // expected-error {{no type named 'b' in namespace 'dont_crash::a'}}
59 } // expected-error {{expected unqualified-id}}