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. 4 5 struct D { 6 typedef int K; 7 }; 8 9 template <typename T> 10 struct A 11 { 12 typedef int Bar; 13 14 template <typename> 15 struct N {}; 16 17 typedef Bar type1; 18 typedef A::Bar type2; 19 typedef A<T>::Bar type3; 20 typedef A<T*>::Bar type4; // { dg-error "" "" { target c++17_down } } 21 typedef typename A<T*>::Bar type5; 22 23 typedef N<int> type6; 24 typedef A::N<int> type7; 25 // { dg-error "" "" { target c++2a } .-1 } 26 typedef A<T>::N<int> type8; 27 // { dg-error "" "" { target c++2a } .-1 } 28 typedef A<T*>::template N<int> type9; // { dg-error "" "" { target c++17_down } } 29 typedef typename A<T*>::template N<int> type10; 30 31 typedef D Bar2; 32 struct N2 { typedef int K; }; 33 34 // Check that A::N2 is still considered dependent (because it 35 // could be specialized), while A::Bar2 (being just ::D) is not. 36 typedef A::Bar2 type11; 37 typedef type11::K k3; 38 39 typedef A::N2 type12; 40 typedef typename type12::K k2; 41 typedef type12::K k1; // { dg-error "" "" { target c++17_down } } 42 43 // Check that A::Bar2 is not considered dependent even if we use 44 // the typename keyword. 45 typedef typename A::Bar2 type13; 46 typedef type13::K k4; 47 }; 48