summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.old-deja/g++.ns/template12.C
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/g++.old-deja/g++.ns/template12.C')
-rw-r--r--gcc/testsuite/g++.old-deja/g++.ns/template12.C19
1 files changed, 19 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.old-deja/g++.ns/template12.C b/gcc/testsuite/g++.old-deja/g++.ns/template12.C
new file mode 100644
index 000000000..32dfe0f2c
--- /dev/null
+++ b/gcc/testsuite/g++.old-deja/g++.ns/template12.C
@@ -0,0 +1,19 @@
+// { dg-do assemble }
+// Templates can be defined outside of the namespace if the have been declared
+// inside
+namespace bar
+{
+ template <typename T>
+ T const foo(T const &);
+ template<> const int foo<int>(int const &);
+}
+
+template <typename T>
+T const
+bar::foo(T const &a)
+{
+ return a;
+}
+
+template<> const int bar::foo<int>(int const &){return 0;}
+