PR c++/24511 - [DR 470] explicit instantiation/extern template unsats
authorMartin Sebor <msebor@redhat.com>
Wed, 11 Jan 2017 21:02:46 +0000 (21:02 +0000)
committerMartin Sebor <msebor@gcc.gnu.org>
Wed, 11 Jan 2017 21:02:46 +0000 (14:02 -0700)
PR c++/24511 - [DR 470] explicit instantiation/extern template unsats
// on symbols defined later

gcc/testsuite/ChangeLog:
* g++.dg/template/explicit9.C: New test.

From-SVN: r244337

gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/template/explicit9.C [new file with mode: 0644]

index 4f281cb..98fd949 100644 (file)
@@ -1,3 +1,8 @@
+2017-01-11  Martin Sebor  <msebor@redhat.com>
+
+       PR c++/24511
+       * g++.dg/template/explicit9.C: New test.
+
 2017-01-11  Nathan Sidwell  <nathan@acm.org>
 
        PR c++/77812
diff --git a/gcc/testsuite/g++.dg/template/explicit9.C b/gcc/testsuite/g++.dg/template/explicit9.C
new file mode 100644 (file)
index 0000000..e4f7d88
--- /dev/null
@@ -0,0 +1,24 @@
+// PR c++/24511 - [DR 470] explicit instantiation/extern template unsats
+// on symbols defined later
+// { dg-do compile }
+
+template <class T> struct S { T foo (); T bar (); };
+template <class T> T S<T>::foo () { return T (); }
+
+#ifndef MAIN
+
+// This part is being tested by the dg-final directive.
+template struct S<int>;
+#else
+
+// This part is not being tested.
+extern template struct S<int>;
+int main ()
+{
+  return S<int>().foo () + S<int>().bar ();
+}
+#endif
+
+template <class T> T S<T>::bar () { return T (); }
+
+// { dg-final { scan-assembler-not "\\\*UND\\\*\[^\n]*_Z1fIiEvPT_" } }