annotate clang/test/Parser/using-template.cpp @ 266:00f31e85ec16 default tip

Added tag current for changeset 31d058e83c98
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Sat, 14 Oct 2023 10:13:55 +0900
parents 1d019706d866
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
150
anatofuz
parents:
diff changeset
1 // RUN: %clang_cc1 %s -verify
anatofuz
parents:
diff changeset
2
anatofuz
parents:
diff changeset
3 namespace N1 {
anatofuz
parents:
diff changeset
4 template <typename... Ts>
anatofuz
parents:
diff changeset
5 struct Foo {
anatofuz
parents:
diff changeset
6 template <typename T>
anatofuz
parents:
diff changeset
7 struct Bar {
anatofuz
parents:
diff changeset
8 static constexpr bool is_present = false;
anatofuz
parents:
diff changeset
9 };
anatofuz
parents:
diff changeset
10 };
anatofuz
parents:
diff changeset
11
anatofuz
parents:
diff changeset
12 template <typename T, typename... Ts>
anatofuz
parents:
diff changeset
13 struct Foo<T, Ts...> : public Foo<Ts...> {
anatofuz
parents:
diff changeset
14 using template Foo<Ts...>::Bar;
anatofuz
parents:
diff changeset
15 // expected-error@-1 {{'template' keyword not permitted after 'using' keyword}}
anatofuz
parents:
diff changeset
16 };
anatofuz
parents:
diff changeset
17 }
anatofuz
parents:
diff changeset
18
anatofuz
parents:
diff changeset
19 namespace N2 {
anatofuz
parents:
diff changeset
20 namespace foo {
anatofuz
parents:
diff changeset
21 using I = int;
anatofuz
parents:
diff changeset
22 }
anatofuz
parents:
diff changeset
23 using template namespace foo;
anatofuz
parents:
diff changeset
24 // expected-error@-1 {{'template' keyword not permitted after 'using' keyword}}
anatofuz
parents:
diff changeset
25 using template template namespace foo;
anatofuz
parents:
diff changeset
26 // expected-error@-1 2{{'template' keyword not permitted after 'using' keyword}}
anatofuz
parents:
diff changeset
27 I i;
anatofuz
parents:
diff changeset
28 }
anatofuz
parents:
diff changeset
29
anatofuz
parents:
diff changeset
30 namespace N3 {
anatofuz
parents:
diff changeset
31 namespace foo {
anatofuz
parents:
diff changeset
32 using I = int;
anatofuz
parents:
diff changeset
33 }
anatofuz
parents:
diff changeset
34 using template foo::I;
anatofuz
parents:
diff changeset
35 // expected-error@-1 {{'template' keyword not permitted after 'using' keyword}}
anatofuz
parents:
diff changeset
36 I i;
anatofuz
parents:
diff changeset
37 }
anatofuz
parents:
diff changeset
38
anatofuz
parents:
diff changeset
39 namespace N4 {
anatofuz
parents:
diff changeset
40 template <typename T>
anatofuz
parents:
diff changeset
41 class A {};
anatofuz
parents:
diff changeset
42
anatofuz
parents:
diff changeset
43 template <typename T>
anatofuz
parents:
diff changeset
44 using B = A<T>;
anatofuz
parents:
diff changeset
45 B<int> b;
anatofuz
parents:
diff changeset
46
anatofuz
parents:
diff changeset
47 using template <typename T> C = A<T>;
anatofuz
parents:
diff changeset
48 // expected-error@-1 {{'template' keyword not permitted after 'using' keyword}}
anatofuz
parents:
diff changeset
49 // expected-error@-2 {{expected unqualified-id}}
anatofuz
parents:
diff changeset
50 C<int> c;
anatofuz
parents:
diff changeset
51 // expected-error@-1 {{no template named 'C'}}
anatofuz
parents:
diff changeset
52 }