diff --git a/gcc/testsuite/g++.dg/template/vtable1.C b/gcc/testsuite/g++.dg/template/vtable1.C
new file mode 100644
index 0000000000000000000000000000000000000000..c5f122adbd93122ab2878cb7ee316a320754ca7f
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/vtable1.C
@@ -0,0 +1,23 @@
+// Test that vtables are set up properly for constructors and destructors
+// of template classes.
+
+// { dg-do run }
+
+int r;
+
+template <class T>
+struct A {
+  virtual void f () { }
+  A() { f (); }
+  ~A() { f (); }
+};
+
+struct B : public A<int> {
+  virtual void f () { ++r; }
+};
+
+int main ()
+{
+  { B b; }
+  return r;
+}