summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/torture/pr42110.C
blob: c778b4f2fd73db3b7f85a527535c3655d8b36c69 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
/* { dg-do compile } */
bool foo();

struct A
{
  A* fooA() { if (foo()) foo(); return this; }

  virtual void barA(char);
};

template<int> struct B
{
  A *p, *q;

  void fooB(char c) { p->fooA()->barA(c); }
};

template<int N> inline void bar(B<N> b) { b.fooB(0); }

extern template void bar(B<0>);

void (*f)(B<0>) = bar;

void baz()
{
  B<0>().fooB(0);
}