diff options
Diffstat (limited to 'gcc/testsuite/g++.old-deja/g++.pt/local6.C')
-rw-r--r-- | gcc/testsuite/g++.old-deja/g++.pt/local6.C | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.old-deja/g++.pt/local6.C b/gcc/testsuite/g++.old-deja/g++.pt/local6.C new file mode 100644 index 000000000..c03c6cd7b --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/local6.C @@ -0,0 +1,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(); +} |