[PR c++/84702] ICE with default tmpl arg of overload set
[official-gcc.git] / gcc / testsuite / g++.dg / template / dependent-name5.C
blob681060c7002e93e7a2288321118c86f3cab6fb66
1 // PR c++/9634, c++/29469, c++/29607
2 // Contributed by: Giovanni Bajo <giovannibajo at gcc dot gnu dot org>
3 // DR224: Make sure that a name is *truly* semantically dependent.
5 struct D {
6   typedef int K;
7 };
9 template <typename T>
10 struct A
12   typedef int Bar;
14   template <typename>
15   struct N {};
17   typedef Bar          type1;
18   typedef A::Bar       type2;
19   typedef A<T>::Bar    type3;
20   typedef A<T*>::Bar    type4;  // { dg-error "" }
21   typedef typename A<T*>::Bar type5;
23   typedef N<int>       type6;
24   typedef A::N<int>    type7;
25   typedef A<T>::N<int> type8;
26   typedef A<T*>::template N<int> type9;  // { dg-error "" }
27   typedef typename A<T*>::template N<int> type10;
29   typedef D Bar2;
30   struct N2 { typedef int K; };
32   // Check that A::N2 is still considered dependent (because it
33   //  could be specialized), while A::Bar2 (being just ::D) is not.
34   typedef A::Bar2 type11;
35   typedef type11::K k3;
37   typedef A::N2 type12;
38   typedef typename type12::K k2;
39   typedef type12::K k1;  // { dg-error "" }
41   // Check that A::Bar2 is not considered dependent even if we use
42   // the typename keyword.
43   typedef typename A::Bar2 type13;
44   typedef type13::K k4;