view gcc/testsuite/g++.dg/template/lookup12.C @ 158:494b0b89df80 default tip

...
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Mon, 25 May 2020 18:13:55 +0900
parents 2b5abeee2509
children
line wrap: on
line source

// PR c++/94799 - member template function lookup fails.

template<typename T> struct B {
  void foo ();
  int i;
};

template<typename T>
struct D : public B<T> { };

template<typename T>
void fn (D<T> d)
{
  d.template B<T>::foo ();
  d.template B<T>::i = 42;
  D<T>().template B<T>::foo ();
  d.template D<T>::template B<T>::foo ();
  d.template D<T>::template B<T>::i = 10;
}

int
main ()
{
  D<int> d;
  fn(d);
}