Debian Codegraph @

gcc/testsuite/g++.dg/lookup/using64.C

raw
1 // PR c++/98687
2 // { dg-do compile }
3
4 struct S { };
5
6 namespace N {
7 template <typename T>
8 bool operator==(T, int);
9
10 template <typename T>
11 void X(T);
12 }
13
14 namespace M {
15 template <typename T>
16 bool operator==(T, double);
17 }
18
19 template<typename T>
20 bool fn1 (T t)
21 {
22 using N::operator==;
23 return t == 1;
24 }
25
26 template<typename T>
27 bool fn2 (T t)
28 {
29 // Redeclaration.
30 using N::operator==;
31 using N::operator==;
32 return t == 1;
33 }
34
35 template<typename T>
36 bool fn3 (T t)
37 {
38 // Need update_local_overload.
39 using N::operator==;
40 using M::operator==;
41 return t == 1;
42 }
43
44 template<typename T>
45 void fn4 (T)
46 {
47 struct X { };
48 using N::X;
49 X(1);
50 }
51
52 template<typename T>
53 void fn5 (T)
54 {
55 int S;
56 using ::S;
57 struct S s;
58 }
59
60 void
61 g ()
62 {
63 S s;
64 fn1 (s);
65 fn2 (s);
66 fn3 (s);
67 fn4 (s);
68 fn5 (s);
69 }