aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.8/gcc/testsuite/g++.dg/template
diff options
context:
space:
mode:
Diffstat (limited to 'gcc-4.8/gcc/testsuite/g++.dg/template')
-rw-r--r--gcc-4.8/gcc/testsuite/g++.dg/template/partial15.C19
-rw-r--r--gcc-4.8/gcc/testsuite/g++.dg/template/ref7.C16
-rw-r--r--gcc-4.8/gcc/testsuite/g++.dg/template/shadow1.C4
-rw-r--r--gcc-4.8/gcc/testsuite/g++.dg/template/using27.C33
-rw-r--r--gcc-4.8/gcc/testsuite/g++.dg/template/using28.C17
-rw-r--r--gcc-4.8/gcc/testsuite/g++.dg/template/using29.C21
6 files changed, 110 insertions, 0 deletions
diff --git a/gcc-4.8/gcc/testsuite/g++.dg/template/partial15.C b/gcc-4.8/gcc/testsuite/g++.dg/template/partial15.C
new file mode 100644
index 000000000..357bb05fa
--- /dev/null
+++ b/gcc-4.8/gcc/testsuite/g++.dg/template/partial15.C
@@ -0,0 +1,19 @@
+// PR c++/57043
+// { dg-do link }
+
+template<typename D> struct complex { };
+
+template<typename Tp>
+complex<Tp>
+pow(const complex<Tp>& x, const complex<Tp>& y) { return complex<Tp>(); }
+
+template<typename T, typename U>
+struct promote_2 { typedef T type; };
+
+template<typename Tp, typename Up>
+complex<typename promote_2<Tp, Up>::type>
+pow(const complex<Tp>& x, const complex<Up>& y);
+
+complex<double> (*powcc)(const complex<double>&, const complex<double>&) = pow;
+
+int main() {}
diff --git a/gcc-4.8/gcc/testsuite/g++.dg/template/ref7.C b/gcc-4.8/gcc/testsuite/g++.dg/template/ref7.C
new file mode 100644
index 000000000..432929272
--- /dev/null
+++ b/gcc-4.8/gcc/testsuite/g++.dg/template/ref7.C
@@ -0,0 +1,16 @@
+// PR c++/60274
+
+typedef const char *const& ProtocolIdType;
+
+template <ProtocolIdType protocolId>
+struct C {
+ typedef int ProtocolVersion;
+ struct D {
+ ProtocolVersion GetProtocolVersion();
+ };
+};
+template <ProtocolIdType protocolId>
+typename C<protocolId>::ProtocolVersion C<protocolId>::D::GetProtocolVersion()
+{
+ return 1;
+}
diff --git a/gcc-4.8/gcc/testsuite/g++.dg/template/shadow1.C b/gcc-4.8/gcc/testsuite/g++.dg/template/shadow1.C
new file mode 100644
index 000000000..6eb30d094
--- /dev/null
+++ b/gcc-4.8/gcc/testsuite/g++.dg/template/shadow1.C
@@ -0,0 +1,4 @@
+// PR c++/58632
+
+template<template<int I> class A> // { dg-message "shadows" }
+class A {}; // { dg-error "declaration" }
diff --git a/gcc-4.8/gcc/testsuite/g++.dg/template/using27.C b/gcc-4.8/gcc/testsuite/g++.dg/template/using27.C
new file mode 100644
index 000000000..f1835e171
--- /dev/null
+++ b/gcc-4.8/gcc/testsuite/g++.dg/template/using27.C
@@ -0,0 +1,33 @@
+// PR c++/37140
+
+struct X
+{
+ typedef int nested_type;
+};
+
+template <class T>
+struct A
+{
+ typedef X type;
+};
+
+template <class T>
+struct B : A<T>
+{
+ using typename A<T>::type;
+ typename type::nested_type x;
+};
+
+template <class T>
+struct C : B<T>
+{
+ using typename B<T>::type;
+ typename type::nested_type y;
+};
+
+struct D : C<int>
+{
+ using C<int>::type;
+ type::nested_type z;
+};
+
diff --git a/gcc-4.8/gcc/testsuite/g++.dg/template/using28.C b/gcc-4.8/gcc/testsuite/g++.dg/template/using28.C
new file mode 100644
index 000000000..52f68cfe4
--- /dev/null
+++ b/gcc-4.8/gcc/testsuite/g++.dg/template/using28.C
@@ -0,0 +1,17 @@
+// PR c++/37140
+
+struct C
+{
+ static const int block_size = 1;
+};
+
+template <typename T> struct A {
+ typedef C type;
+};
+
+template <typename T> struct B : public A<T> {
+ using typename A<T>::type;
+ static const int block_size = type::block_size;
+};
+
+template class B<int>;
diff --git a/gcc-4.8/gcc/testsuite/g++.dg/template/using29.C b/gcc-4.8/gcc/testsuite/g++.dg/template/using29.C
new file mode 100644
index 000000000..8726547ef
--- /dev/null
+++ b/gcc-4.8/gcc/testsuite/g++.dg/template/using29.C
@@ -0,0 +1,21 @@
+// PR c++/58047
+
+template <int N>
+struct print_arg { };
+
+struct const_holder {
+ static const int CONSTANT = 42;
+};
+
+template <typename T>
+struct identity {
+ typedef T type;
+};
+
+template <class T>
+struct test_case : public identity<T> {
+ using typename identity<T>::type;
+ print_arg<type::CONSTANT> printer;
+};
+
+template struct test_case<const_holder>;