summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.old-deja/g++.pt/local6.C
blob: c03c6cd7ba4953cf2adb3bdfaeecd50607f0fbc4 (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
// { dg-do run  }
extern "C" void abort();

template <class T>
int f(T)
{
  struct S1 {
    virtual int foo() { return 1; }
  };

  struct S2 : public S1 {
    int foo() { return 2; }
  };

  S1* s2 = new S2;

  return s2->foo();
}


int main()
{
  if (f(3) != 2)
    abort();
}