aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/template/spec12.C
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/g++.dg/template/spec12.C')
-rw-r--r--gcc/testsuite/g++.dg/template/spec12.C18
1 files changed, 18 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/template/spec12.C b/gcc/testsuite/g++.dg/template/spec12.C
new file mode 100644
index 00000000000..7cf2e2f0aa2
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/spec12.C
@@ -0,0 +1,18 @@
+// { dg-do compile }
+// Contributed by: Wolfgang Bangerth <bangerth at dealii dot org>
+// PR c++/14409: Accepts invalid function signature for explicit instantiation
+
+struct X
+{
+ template <typename U>
+ void foo (U) {}
+
+ template <typename U>
+ void foo_const (U) const {}
+};
+
+template void X::foo (int);
+template void X::foo_const (int) const;
+
+template void X::foo (int) const; // { dg-error "" }
+template void X::foo_const (int); // { dg-error "" }