annotate clang/test/Misc/diag-inline-namespace.cpp @ 207:2e18cbf3894f

LLVM12
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Tue, 08 Jun 2021 06:07:14 +0900
parents
children c4bab56944e8
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
207
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1 // RUN: %clang_cc1 -verify %s -std=c++20
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
3 // We avoid printing the name of an inline namespace unless it's necessary to
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
4 // uniquely identify the target.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
5 namespace N {
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
6 inline namespace A {
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
7 inline namespace B {
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
8 inline namespace C {
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
9 int f, g, h, i, j;
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
10 struct f; struct g; struct h; struct i; struct j;
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
11 }
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
12 struct g;
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
13 struct j;
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
14 }
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
15 struct h;
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
16 }
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
17 struct i;
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
18 struct j;
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
19
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
20 template<int*> struct Q; // expected-note 5{{here}}
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
21 Q<&A::B::C::f> q1; // expected-error {{implicit instantiation of undefined template 'N::Q<&N::f>'}}
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
22 Q<&A::B::C::g> q2; // expected-error {{implicit instantiation of undefined template 'N::Q<&N::C::g>'}}
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
23 Q<&A::B::C::h> q3; // expected-error {{implicit instantiation of undefined template 'N::Q<&N::B::h>'}}
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
24 Q<&A::B::C::i> q4; // expected-error {{implicit instantiation of undefined template 'N::Q<&N::A::i>'}}
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
25 Q<&A::B::C::j> q5; // expected-error {{implicit instantiation of undefined template 'N::Q<&N::C::j>'}}
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
26
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
27 template<typename> struct R; // expected-note 5{{here}}
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
28 R<struct A::B::C::f> r1; // expected-error {{implicit instantiation of undefined template 'N::R<N::f>'}}
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
29 R<struct A::B::C::g> r2; // expected-error {{implicit instantiation of undefined template 'N::R<N::C::g>'}}
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
30 R<struct A::B::C::h> r3; // expected-error {{implicit instantiation of undefined template 'N::R<N::B::h>'}}
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
31 R<struct A::B::C::i> r4; // expected-error {{implicit instantiation of undefined template 'N::R<N::A::i>'}}
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
32 R<struct A::B::C::j> r5; // expected-error {{implicit instantiation of undefined template 'N::R<N::C::j>'}}
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
33
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
34 // Make the name N::C ambiguous.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
35 inline namespace A { int C; }
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
36
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
37 template<int*> struct S; // expected-note 5{{here}}
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
38 S<&A::B::C::f> s1; // expected-error {{implicit instantiation of undefined template 'N::S<&N::f>'}}
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
39 S<&A::B::C::g> s2; // expected-error {{implicit instantiation of undefined template 'N::S<&N::B::C::g>'}}
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
40 S<&A::B::C::h> s3; // expected-error {{implicit instantiation of undefined template 'N::S<&N::B::h>'}}
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
41 S<&A::B::C::i> s4; // expected-error {{implicit instantiation of undefined template 'N::S<&N::A::i>'}}
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
42 S<&A::B::C::j> s5; // expected-error {{implicit instantiation of undefined template 'N::S<&N::B::C::j>'}}
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
43
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
44 template<typename> struct T; // expected-note 5{{here}}
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
45 T<struct A::B::C::f> t1; // expected-error {{implicit instantiation of undefined template 'N::T<N::f>'}}
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
46 T<struct A::B::C::g> t2; // expected-error {{implicit instantiation of undefined template 'N::T<N::B::C::g>'}}
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
47 T<struct A::B::C::h> t3; // expected-error {{implicit instantiation of undefined template 'N::T<N::B::h>'}}
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
48 T<struct A::B::C::i> t4; // expected-error {{implicit instantiation of undefined template 'N::T<N::A::i>'}}
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
49 T<struct A::B::C::j> t5; // expected-error {{implicit instantiation of undefined template 'N::T<N::B::C::j>'}}
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
50 }