mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-03-07 22:17:19 +08:00
new testcases
From-SVN: r15214
This commit is contained in:
parent
2ca340aed3
commit
1dec6c7b3d
18
gcc/testsuite/g++.old-deja/g++.pt/enum.C
Normal file
18
gcc/testsuite/g++.old-deja/g++.pt/enum.C
Normal file
@ -0,0 +1,18 @@
|
||||
// Build don't link:
|
||||
// GROUPS passed enums
|
||||
template<class T>
|
||||
struct templ
|
||||
{
|
||||
enum { val = 0 };
|
||||
};
|
||||
struct Foo
|
||||
{
|
||||
enum {
|
||||
bar = 0,
|
||||
len = templ<int>::val
|
||||
};
|
||||
};
|
||||
void func()
|
||||
{
|
||||
int s = Foo::bar; // Ensure that expansion of templ did not erase bar
|
||||
}
|
15
gcc/testsuite/g++.old-deja/g++.pt/memtemp1.C
Normal file
15
gcc/testsuite/g++.old-deja/g++.pt/memtemp1.C
Normal file
@ -0,0 +1,15 @@
|
||||
// Build don't link:
|
||||
// GROUPS passed templates membertemplates
|
||||
struct S {
|
||||
template <class T>
|
||||
void foo(T&);
|
||||
};
|
||||
|
||||
|
||||
template <class T>
|
||||
void S::foo(T&)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
24
gcc/testsuite/g++.old-deja/g++.pt/memtemp10.C
Normal file
24
gcc/testsuite/g++.old-deja/g++.pt/memtemp10.C
Normal file
@ -0,0 +1,24 @@
|
||||
// Build don't run:
|
||||
// GROUPS passed templates membertemplates
|
||||
extern "C" int printf(const char*, ...);
|
||||
|
||||
struct S {
|
||||
template <class T>
|
||||
operator T*();
|
||||
};
|
||||
|
||||
|
||||
template <class T>
|
||||
S::operator T*()
|
||||
{
|
||||
printf("Hello, world.\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int main()
|
||||
{
|
||||
S s;
|
||||
|
||||
char* cp = s.operator char*();
|
||||
}
|
27
gcc/testsuite/g++.old-deja/g++.pt/memtemp11.C
Normal file
27
gcc/testsuite/g++.old-deja/g++.pt/memtemp11.C
Normal file
@ -0,0 +1,27 @@
|
||||
// Build don't run:
|
||||
// GROUPS passed templates membertemplates
|
||||
extern "C" int printf(const char*, ...);
|
||||
|
||||
struct S
|
||||
{
|
||||
template <class U>
|
||||
S(U u, int i) {}
|
||||
|
||||
template <class T>
|
||||
T foo(T t)
|
||||
{
|
||||
printf("Hello, world.\n");
|
||||
return t;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
int main()
|
||||
{
|
||||
S s(3, 4);
|
||||
int i = s.foo(3);
|
||||
s.foo("hello");
|
||||
s.foo(s);
|
||||
|
||||
S s2("hello", 5);
|
||||
}
|
13
gcc/testsuite/g++.old-deja/g++.pt/memtemp12.C
Normal file
13
gcc/testsuite/g++.old-deja/g++.pt/memtemp12.C
Normal file
@ -0,0 +1,13 @@
|
||||
// Build don't link:
|
||||
// GROUPS passed templates membertemplates
|
||||
template <class T>
|
||||
struct S
|
||||
{
|
||||
template <class U>
|
||||
void foo(U);
|
||||
};
|
||||
|
||||
void f()
|
||||
{
|
||||
S<int> s;
|
||||
}
|
15
gcc/testsuite/g++.old-deja/g++.pt/memtemp13.C
Normal file
15
gcc/testsuite/g++.old-deja/g++.pt/memtemp13.C
Normal file
@ -0,0 +1,15 @@
|
||||
// Build don't link:
|
||||
// GROUPS passed templates membertemplates
|
||||
template <class T>
|
||||
struct S
|
||||
{
|
||||
template <class U>
|
||||
void foo(U);
|
||||
};
|
||||
|
||||
void f()
|
||||
{
|
||||
S<int> s;
|
||||
s.foo(3);
|
||||
s.foo("hello");
|
||||
}
|
30
gcc/testsuite/g++.old-deja/g++.pt/memtemp14.C
Normal file
30
gcc/testsuite/g++.old-deja/g++.pt/memtemp14.C
Normal file
@ -0,0 +1,30 @@
|
||||
// Build don't run:
|
||||
// GROUPS passed templates membertemplates
|
||||
extern "C" const char* printf(const char*, ...);
|
||||
|
||||
template <class T>
|
||||
struct S
|
||||
{
|
||||
template <class U, class V>
|
||||
void foo(U, V);
|
||||
};
|
||||
|
||||
|
||||
template <class T>
|
||||
template <class U, class V>
|
||||
void S<T>::foo(U, V)
|
||||
{
|
||||
printf("Hello, world.\n");
|
||||
}
|
||||
|
||||
|
||||
int main()
|
||||
{
|
||||
S<int> s;
|
||||
s.foo(3, 3);
|
||||
s.foo("hello", s);
|
||||
|
||||
S<char*> s2;
|
||||
s2.foo(3, 3);
|
||||
s2.foo("hello", s);
|
||||
}
|
16
gcc/testsuite/g++.old-deja/g++.pt/memtemp15.C
Normal file
16
gcc/testsuite/g++.old-deja/g++.pt/memtemp15.C
Normal file
@ -0,0 +1,16 @@
|
||||
// Build don't link:
|
||||
// GROUPS passed templates membertemplates
|
||||
template <class T>
|
||||
struct S
|
||||
{
|
||||
template <class U>
|
||||
void foo(U) {}
|
||||
};
|
||||
|
||||
|
||||
void f()
|
||||
{
|
||||
S<int> s;
|
||||
s.foo(3);
|
||||
s.foo("hello");
|
||||
}
|
30
gcc/testsuite/g++.old-deja/g++.pt/memtemp16.C
Normal file
30
gcc/testsuite/g++.old-deja/g++.pt/memtemp16.C
Normal file
@ -0,0 +1,30 @@
|
||||
// Build don't run:
|
||||
// GROUPS passed templates membertemplates
|
||||
extern "C" int printf(const char*, ...);
|
||||
|
||||
template <class U>
|
||||
struct S {
|
||||
template <class T>
|
||||
void operator+(T);
|
||||
};
|
||||
|
||||
template <class U>
|
||||
template <class T>
|
||||
void S<U>::operator+(T)
|
||||
{
|
||||
printf("Hello, world.\n");
|
||||
}
|
||||
|
||||
|
||||
int main()
|
||||
{
|
||||
S<int> s;
|
||||
s + 3;
|
||||
s + s;
|
||||
s.operator+("Hi");
|
||||
|
||||
S<S<int> > s2;
|
||||
s2 + 3;
|
||||
s2 + s;
|
||||
s2.operator+("Hi");
|
||||
}
|
26
gcc/testsuite/g++.old-deja/g++.pt/memtemp17.C
Normal file
26
gcc/testsuite/g++.old-deja/g++.pt/memtemp17.C
Normal file
@ -0,0 +1,26 @@
|
||||
// Build don't run:
|
||||
// GROUPS passed templates membertemplates
|
||||
extern "C" int printf(const char*, ...);
|
||||
|
||||
template <class V>
|
||||
struct S {
|
||||
template <class T, class U>
|
||||
S(T, U, T);
|
||||
};
|
||||
|
||||
|
||||
template <class V>
|
||||
template <class T, class U>
|
||||
S<V>::S(T t1, U u1, T t2)
|
||||
{
|
||||
printf("Hello, world.\n");
|
||||
}
|
||||
|
||||
|
||||
int main()
|
||||
{
|
||||
S<int> s1(3, "abc", 3);
|
||||
S<int> s2('a', s1, 'a');
|
||||
|
||||
S<char> s3("abc", 3, "abc");
|
||||
}
|
16
gcc/testsuite/g++.old-deja/g++.pt/memtemp18.C
Normal file
16
gcc/testsuite/g++.old-deja/g++.pt/memtemp18.C
Normal file
@ -0,0 +1,16 @@
|
||||
// Build don't link:
|
||||
// GROUPS passed templates membertemplates
|
||||
struct S
|
||||
{
|
||||
template <class T>
|
||||
void foo(T);
|
||||
};
|
||||
|
||||
template void S::foo(int);
|
||||
|
||||
int main()
|
||||
{
|
||||
S s;
|
||||
s.foo(3);
|
||||
}
|
||||
|
25
gcc/testsuite/g++.old-deja/g++.pt/memtemp19.C
Normal file
25
gcc/testsuite/g++.old-deja/g++.pt/memtemp19.C
Normal file
@ -0,0 +1,25 @@
|
||||
// Build don't run:
|
||||
// GROUPS passed templates membertemplates
|
||||
extern "C" int printf(const char*, ...);
|
||||
|
||||
struct S {
|
||||
template <class T>
|
||||
operator T();
|
||||
};
|
||||
|
||||
template <class T>
|
||||
S::operator T()
|
||||
{
|
||||
printf("Hello, world.\n");
|
||||
return T();
|
||||
}
|
||||
|
||||
|
||||
template S::operator int();
|
||||
|
||||
int main()
|
||||
{
|
||||
S s;
|
||||
|
||||
int i = s.operator int();
|
||||
}
|
15
gcc/testsuite/g++.old-deja/g++.pt/memtemp2.C
Normal file
15
gcc/testsuite/g++.old-deja/g++.pt/memtemp2.C
Normal file
@ -0,0 +1,15 @@
|
||||
// Build don't link:
|
||||
// GROUPS passed templates membertemplates
|
||||
struct S {
|
||||
template <class T>
|
||||
void foo(T&);
|
||||
};
|
||||
|
||||
|
||||
template <class U>
|
||||
void S::foo(U&)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
45
gcc/testsuite/g++.old-deja/g++.pt/memtemp20.C
Normal file
45
gcc/testsuite/g++.old-deja/g++.pt/memtemp20.C
Normal file
@ -0,0 +1,45 @@
|
||||
// Build don't run:
|
||||
// GROUPS passed templates membertemplates
|
||||
extern "C" int printf(const char*, ...);
|
||||
|
||||
struct S
|
||||
{
|
||||
template <class T, class U>
|
||||
void foo(T t, U u);
|
||||
|
||||
template <class U>
|
||||
void foo(char*, U);
|
||||
|
||||
template <>
|
||||
void foo(int i);
|
||||
};
|
||||
|
||||
template <class T, class U>
|
||||
void S::foo(T t, U u)
|
||||
{
|
||||
printf ("T,U version\n");
|
||||
}
|
||||
|
||||
|
||||
template <class U>
|
||||
void S::foo(char*, U u)
|
||||
{
|
||||
printf ("char*,U version\n");
|
||||
}
|
||||
|
||||
|
||||
template <>
|
||||
void S::foo(int i)
|
||||
{
|
||||
printf ("int version\n");
|
||||
}
|
||||
|
||||
|
||||
int main()
|
||||
{
|
||||
S s;
|
||||
s.foo(3);
|
||||
s.foo(3, 3);
|
||||
s.foo("abc", s);
|
||||
}
|
||||
|
24
gcc/testsuite/g++.old-deja/g++.pt/memtemp23.C
Normal file
24
gcc/testsuite/g++.old-deja/g++.pt/memtemp23.C
Normal file
@ -0,0 +1,24 @@
|
||||
// Build don't run:
|
||||
// GROUPS passed templates membertemplates
|
||||
extern "C" int printf(const char*, ...);
|
||||
|
||||
template <class X>
|
||||
struct S
|
||||
{
|
||||
S()
|
||||
{ printf ("In S::S()\n"); f(3); }
|
||||
|
||||
S(char)
|
||||
{ printf ("In S::S(char)\n"); f(*this); }
|
||||
|
||||
template <class U>
|
||||
void f(U u)
|
||||
{ printf ("In S::f(U)\nsizeof(U) == %d\n", sizeof(u)); }
|
||||
|
||||
int c[16];
|
||||
};
|
||||
|
||||
int main()
|
||||
{
|
||||
S<char*> s;
|
||||
}
|
25
gcc/testsuite/g++.old-deja/g++.pt/memtemp24.C
Normal file
25
gcc/testsuite/g++.old-deja/g++.pt/memtemp24.C
Normal file
@ -0,0 +1,25 @@
|
||||
// Build don't run:
|
||||
// GROUPS passed templates membertemplates
|
||||
extern "C" int printf(const char*, ...);
|
||||
|
||||
template <class X>
|
||||
struct S
|
||||
{
|
||||
S()
|
||||
{ printf ("In S::S()\n"); f(3); }
|
||||
|
||||
S(char)
|
||||
{ printf ("In S::S(char)\n"); f(*this); }
|
||||
|
||||
template <class U>
|
||||
void f(U u)
|
||||
{ printf ("In S::f(U)\nsizeof(U) == %d\n", sizeof(u)); }
|
||||
|
||||
int c[16];
|
||||
};
|
||||
|
||||
int main()
|
||||
{
|
||||
S<char*> s;
|
||||
S<char*> s2('a');
|
||||
}
|
20
gcc/testsuite/g++.old-deja/g++.pt/memtemp25.C
Normal file
20
gcc/testsuite/g++.old-deja/g++.pt/memtemp25.C
Normal file
@ -0,0 +1,20 @@
|
||||
// Build don't run:
|
||||
// GROUPS passed templates membertemplates
|
||||
extern "C" int printf(const char*, ...);
|
||||
|
||||
template <class X>
|
||||
struct S
|
||||
{
|
||||
template <class U>
|
||||
void f(U u) { printf ("%d\n", sizeof (U)); }
|
||||
|
||||
int i[4];
|
||||
};
|
||||
|
||||
|
||||
int main()
|
||||
{
|
||||
S<char*> s;
|
||||
s.f(3);
|
||||
s.f(s);
|
||||
}
|
28
gcc/testsuite/g++.old-deja/g++.pt/memtemp26.C
Normal file
28
gcc/testsuite/g++.old-deja/g++.pt/memtemp26.C
Normal file
@ -0,0 +1,28 @@
|
||||
// Build don't run:
|
||||
// GROUPS passed templates membertemplates
|
||||
extern "C" int printf(const char*, ...);
|
||||
|
||||
template <class X>
|
||||
struct S
|
||||
{
|
||||
template <class U>
|
||||
void f(U u);
|
||||
|
||||
int i[4];
|
||||
};
|
||||
|
||||
|
||||
template <class X>
|
||||
template <class U>
|
||||
void S<X>::f(U u)
|
||||
{
|
||||
printf ("%d\n", sizeof (U));
|
||||
}
|
||||
|
||||
|
||||
int main()
|
||||
{
|
||||
S<char*> s;
|
||||
s.f(3);
|
||||
s.f(s);
|
||||
}
|
25
gcc/testsuite/g++.old-deja/g++.pt/memtemp27.C
Normal file
25
gcc/testsuite/g++.old-deja/g++.pt/memtemp27.C
Normal file
@ -0,0 +1,25 @@
|
||||
// Build don't run:
|
||||
// GROUPS passed templates membertemplates
|
||||
extern "C" int printf(const char*, ...);
|
||||
|
||||
template <class X>
|
||||
struct S
|
||||
{
|
||||
S()
|
||||
{ printf ("In S::S()\n"); f(3); }
|
||||
|
||||
S(char)
|
||||
{ printf ("In S::S(char)\n"); f(*this); }
|
||||
|
||||
template <class U>
|
||||
void f(U u)
|
||||
{ printf ("In S::f(U)\nsizeof(U) == %d\n", sizeof(u)); }
|
||||
|
||||
int c[16];
|
||||
};
|
||||
|
||||
int main()
|
||||
{
|
||||
S<char*> s;
|
||||
S<char*> s2('a');
|
||||
}
|
24
gcc/testsuite/g++.old-deja/g++.pt/memtemp28.C
Normal file
24
gcc/testsuite/g++.old-deja/g++.pt/memtemp28.C
Normal file
@ -0,0 +1,24 @@
|
||||
// Build don't run:
|
||||
// GROUPS passed templates membertemplates
|
||||
extern "C" int printf(const char*, ...);
|
||||
|
||||
template <class X>
|
||||
struct S
|
||||
{
|
||||
template <class U>
|
||||
void f(U u)
|
||||
{ printf ("In S::f(U)\n"); g(u); }
|
||||
|
||||
template <class U>
|
||||
void g(U u)
|
||||
{ printf ("In S::g(U)\n"); }
|
||||
|
||||
int c[16];
|
||||
};
|
||||
|
||||
int main()
|
||||
{
|
||||
S<char*> s;
|
||||
s.f(3);
|
||||
s.f("adf");
|
||||
}
|
32
gcc/testsuite/g++.old-deja/g++.pt/memtemp29.C
Normal file
32
gcc/testsuite/g++.old-deja/g++.pt/memtemp29.C
Normal file
@ -0,0 +1,32 @@
|
||||
// Build don't run:
|
||||
// GROUPS passed templates membertemplates
|
||||
extern "C" int printf(const char*, ...);
|
||||
|
||||
template <class X>
|
||||
struct S
|
||||
{
|
||||
template <class U>
|
||||
void f(U u);
|
||||
|
||||
template <class U>
|
||||
void g(U U);
|
||||
|
||||
int c[16];
|
||||
};
|
||||
|
||||
template <class X>
|
||||
template <class U>
|
||||
void S<X>::f(U u)
|
||||
{ printf ("In S::f(U)\n"); g(u); }
|
||||
|
||||
template <class X>
|
||||
template <class U>
|
||||
void S<X>::g(U u)
|
||||
{ printf ("In S::g(U)\n"); }
|
||||
|
||||
int main()
|
||||
{
|
||||
S<char*> s;
|
||||
s.f(3);
|
||||
s.f("adf");
|
||||
}
|
24
gcc/testsuite/g++.old-deja/g++.pt/memtemp3.C
Normal file
24
gcc/testsuite/g++.old-deja/g++.pt/memtemp3.C
Normal file
@ -0,0 +1,24 @@
|
||||
// Build don't run:
|
||||
// GROUPS passed templates membertemplates
|
||||
extern "C" int printf(const char*, ...);
|
||||
|
||||
struct S {
|
||||
template <class T>
|
||||
void foo(T);
|
||||
};
|
||||
|
||||
|
||||
template <class T>
|
||||
void S::foo(T)
|
||||
{
|
||||
printf("Hello, world.\n");
|
||||
}
|
||||
|
||||
|
||||
|
||||
int main()
|
||||
{
|
||||
S s;
|
||||
s.foo(3);
|
||||
s.foo(s);
|
||||
}
|
17
gcc/testsuite/g++.old-deja/g++.pt/memtemp30.C
Normal file
17
gcc/testsuite/g++.old-deja/g++.pt/memtemp30.C
Normal file
@ -0,0 +1,17 @@
|
||||
// Build don't run:
|
||||
// GROUPS passed templates membertemplates
|
||||
extern "C" int printf(const char*, ...);
|
||||
|
||||
template <class X>
|
||||
struct S
|
||||
{
|
||||
template <class U>
|
||||
void g(U u) { this; }
|
||||
};
|
||||
|
||||
|
||||
int main()
|
||||
{
|
||||
S<char*> s;
|
||||
s.g(3);
|
||||
}
|
16
gcc/testsuite/g++.old-deja/g++.pt/memtemp31.C
Normal file
16
gcc/testsuite/g++.old-deja/g++.pt/memtemp31.C
Normal file
@ -0,0 +1,16 @@
|
||||
// Build don't run:
|
||||
// GROUPS passed templates membertemplates
|
||||
extern "C" int printf(const char*, ...);
|
||||
|
||||
struct S
|
||||
{
|
||||
template <class U>
|
||||
void g(U u)
|
||||
{ this; }
|
||||
};
|
||||
|
||||
int main()
|
||||
{
|
||||
S s;
|
||||
s.g(3);
|
||||
}
|
18
gcc/testsuite/g++.old-deja/g++.pt/memtemp32.C
Normal file
18
gcc/testsuite/g++.old-deja/g++.pt/memtemp32.C
Normal file
@ -0,0 +1,18 @@
|
||||
// Build don't run:
|
||||
// GROUPS passed templates membertemplates
|
||||
extern "C" int printf(const char*, ...);
|
||||
|
||||
struct S
|
||||
{
|
||||
template <class U>
|
||||
void g(U u)
|
||||
{ i = 3; }
|
||||
|
||||
int i;
|
||||
};
|
||||
|
||||
int main()
|
||||
{
|
||||
S s;
|
||||
s.g(3);
|
||||
}
|
19
gcc/testsuite/g++.old-deja/g++.pt/memtemp33.C
Normal file
19
gcc/testsuite/g++.old-deja/g++.pt/memtemp33.C
Normal file
@ -0,0 +1,19 @@
|
||||
// Build don't run:
|
||||
// GROUPS passed templates membertemplates
|
||||
extern "C" int printf(const char*, ...);
|
||||
|
||||
template <class T>
|
||||
struct S
|
||||
{
|
||||
template <class U>
|
||||
void g(U u)
|
||||
{ i; }
|
||||
|
||||
int i;
|
||||
};
|
||||
|
||||
int main()
|
||||
{
|
||||
S<char> s;
|
||||
s.g(3);
|
||||
}
|
16
gcc/testsuite/g++.old-deja/g++.pt/memtemp34.C
Normal file
16
gcc/testsuite/g++.old-deja/g++.pt/memtemp34.C
Normal file
@ -0,0 +1,16 @@
|
||||
// Build don't run:
|
||||
// GROUPS passed templates membertemplates
|
||||
template <class T>
|
||||
struct S
|
||||
{
|
||||
template <class U>
|
||||
static void f(U u)
|
||||
{}
|
||||
};
|
||||
|
||||
int main()
|
||||
{
|
||||
S<int>::f(3);
|
||||
S<char>::f("abc");
|
||||
S<int>::f("abc");
|
||||
}
|
21
gcc/testsuite/g++.old-deja/g++.pt/memtemp35.C
Normal file
21
gcc/testsuite/g++.old-deja/g++.pt/memtemp35.C
Normal file
@ -0,0 +1,21 @@
|
||||
// Build don't link:
|
||||
// GROUPS passed templates membertemplates
|
||||
template <class T>
|
||||
struct S
|
||||
{
|
||||
S(const S& s) {}
|
||||
|
||||
template <class U>
|
||||
S(S<U>& s)
|
||||
{
|
||||
S<U> s2(s);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
extern S<int>& si;
|
||||
|
||||
void foo()
|
||||
{
|
||||
S<char*> sc(si);
|
||||
}
|
21
gcc/testsuite/g++.old-deja/g++.pt/memtemp36.C
Normal file
21
gcc/testsuite/g++.old-deja/g++.pt/memtemp36.C
Normal file
@ -0,0 +1,21 @@
|
||||
// Build don't link:
|
||||
// GROUPS passed templates membertemplates
|
||||
template <class X>
|
||||
struct R
|
||||
{
|
||||
};
|
||||
|
||||
|
||||
template <class T>
|
||||
struct S
|
||||
{
|
||||
template <class U>
|
||||
S(R<U> r);
|
||||
};
|
||||
|
||||
|
||||
void foo()
|
||||
{
|
||||
R<int> r;
|
||||
S<char*> s(r);
|
||||
}
|
20
gcc/testsuite/g++.old-deja/g++.pt/memtemp37.C
Normal file
20
gcc/testsuite/g++.old-deja/g++.pt/memtemp37.C
Normal file
@ -0,0 +1,20 @@
|
||||
// Build don't link:
|
||||
// GROUPS passed templates membertemplates
|
||||
template <class T>
|
||||
struct S
|
||||
{
|
||||
template <class U>
|
||||
void f(U u);
|
||||
};
|
||||
|
||||
|
||||
template <class T>
|
||||
template <class U>
|
||||
void S<T>::f(U)
|
||||
{
|
||||
}
|
||||
|
||||
enum
|
||||
{
|
||||
a = 3
|
||||
};
|
17
gcc/testsuite/g++.old-deja/g++.pt/memtemp39.C
Normal file
17
gcc/testsuite/g++.old-deja/g++.pt/memtemp39.C
Normal file
@ -0,0 +1,17 @@
|
||||
// Build don't link:
|
||||
// GROUPS passed templates membertemplates
|
||||
template <class T>
|
||||
struct S
|
||||
{
|
||||
template <class U>
|
||||
void f(U u) { g(u); }
|
||||
|
||||
template <class U>
|
||||
void g(U u) { f(u); }
|
||||
};
|
||||
|
||||
void foo()
|
||||
{
|
||||
S<int> si;
|
||||
si.f(3);
|
||||
}
|
12
gcc/testsuite/g++.old-deja/g++.pt/memtemp4.C
Normal file
12
gcc/testsuite/g++.old-deja/g++.pt/memtemp4.C
Normal file
@ -0,0 +1,12 @@
|
||||
// Build don't link:
|
||||
// GROUPS passed templates membertemplates
|
||||
struct S {
|
||||
template <class T>
|
||||
void operator+(T);
|
||||
};
|
||||
|
||||
|
||||
template <class T>
|
||||
void S::operator+(T)
|
||||
{
|
||||
}
|
21
gcc/testsuite/g++.old-deja/g++.pt/memtemp40.C
Normal file
21
gcc/testsuite/g++.old-deja/g++.pt/memtemp40.C
Normal file
@ -0,0 +1,21 @@
|
||||
// Build don't link:
|
||||
// GROUPS passed templates membertemplates
|
||||
template <class T>
|
||||
struct R
|
||||
{
|
||||
template <class U>
|
||||
void g(U u) {}
|
||||
};
|
||||
|
||||
template <class T>
|
||||
struct S
|
||||
{
|
||||
template <class U>
|
||||
void f(U u) { R<T> r; r.g(u); }
|
||||
};
|
||||
|
||||
void foo()
|
||||
{
|
||||
S<int> si;
|
||||
si.f("abc");
|
||||
}
|
7
gcc/testsuite/g++.old-deja/g++.pt/memtemp41.C
Normal file
7
gcc/testsuite/g++.old-deja/g++.pt/memtemp41.C
Normal file
@ -0,0 +1,7 @@
|
||||
// Build don't link:
|
||||
// GROUPS passed templates membertemplates
|
||||
template <int i>
|
||||
struct S
|
||||
{
|
||||
static void foo() {}
|
||||
};
|
22
gcc/testsuite/g++.old-deja/g++.pt/memtemp42.C
Normal file
22
gcc/testsuite/g++.old-deja/g++.pt/memtemp42.C
Normal file
@ -0,0 +1,22 @@
|
||||
// Build don't run:
|
||||
// GROUPS passed templates membertemplates
|
||||
template<class T, int N>
|
||||
class Foo {
|
||||
|
||||
public:
|
||||
template<int N2>
|
||||
Foo<T,N> operator=(const Foo<T,N2>& z)
|
||||
{
|
||||
return Foo<T,N>();
|
||||
}
|
||||
};
|
||||
|
||||
int main()
|
||||
{
|
||||
Foo<double,4> x;
|
||||
Foo<double,7> y;
|
||||
x = y;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
16
gcc/testsuite/g++.old-deja/g++.pt/memtemp43.C
Normal file
16
gcc/testsuite/g++.old-deja/g++.pt/memtemp43.C
Normal file
@ -0,0 +1,16 @@
|
||||
// Build don't run:
|
||||
// GROUPS passed templates membertemplates
|
||||
template<class T, int N>
|
||||
class A
|
||||
{
|
||||
public:
|
||||
template<class U>
|
||||
void operator=(A<U, N> const & a) { return; }
|
||||
};
|
||||
|
||||
main()
|
||||
{
|
||||
A<float, 3> a;
|
||||
A<double, 3> b;
|
||||
a = b;
|
||||
}
|
20
gcc/testsuite/g++.old-deja/g++.pt/memtemp44.C
Normal file
20
gcc/testsuite/g++.old-deja/g++.pt/memtemp44.C
Normal file
@ -0,0 +1,20 @@
|
||||
// Build don't run:
|
||||
// GROUPS passed templates membertemplates
|
||||
template<class T>
|
||||
class A
|
||||
{
|
||||
};
|
||||
|
||||
template<>
|
||||
class A<float>
|
||||
{
|
||||
public:
|
||||
template<class U>
|
||||
void func(U v1) {}
|
||||
};
|
||||
|
||||
main()
|
||||
{
|
||||
A<float> a;
|
||||
a.func(3);
|
||||
}
|
20
gcc/testsuite/g++.old-deja/g++.pt/memtemp45.C
Normal file
20
gcc/testsuite/g++.old-deja/g++.pt/memtemp45.C
Normal file
@ -0,0 +1,20 @@
|
||||
// Build don't run:
|
||||
// GROUPS passed templates membertemplates
|
||||
template<class T>
|
||||
class A
|
||||
{
|
||||
};
|
||||
|
||||
template<>
|
||||
class A<float>
|
||||
{
|
||||
public:
|
||||
template<class U>
|
||||
void func(U v1 = 0) {}
|
||||
};
|
||||
|
||||
main()
|
||||
{
|
||||
A<float> a;
|
||||
a.func(3);
|
||||
}
|
20
gcc/testsuite/g++.old-deja/g++.pt/memtemp46.C
Normal file
20
gcc/testsuite/g++.old-deja/g++.pt/memtemp46.C
Normal file
@ -0,0 +1,20 @@
|
||||
// Build don't run:
|
||||
// GROUPS passed templates membertemplates
|
||||
template<class T, class U>
|
||||
class A
|
||||
{
|
||||
};
|
||||
|
||||
template<class U>
|
||||
class A<float, U>
|
||||
{
|
||||
public:
|
||||
template <class V>
|
||||
void func(V v1 = 0) {}
|
||||
};
|
||||
|
||||
main()
|
||||
{
|
||||
A<float, int> a;
|
||||
a.func("abc");
|
||||
}
|
29
gcc/testsuite/g++.old-deja/g++.pt/memtemp47.C
Normal file
29
gcc/testsuite/g++.old-deja/g++.pt/memtemp47.C
Normal file
@ -0,0 +1,29 @@
|
||||
// Build don't run:
|
||||
// GROUPS passed templates membertemplates
|
||||
extern "C" int printf(const char*, ...);
|
||||
|
||||
template <class X>
|
||||
struct S
|
||||
{
|
||||
template <class U>
|
||||
void g(U u)
|
||||
{ printf ("In S::g(U)\n"); }
|
||||
|
||||
int c[16];
|
||||
};
|
||||
|
||||
|
||||
template <class X>
|
||||
struct T : public S<X>
|
||||
{
|
||||
template <class U>
|
||||
void f(U u)
|
||||
{ printf ("In T::f(U)\n"); g(u); }
|
||||
};
|
||||
|
||||
int main()
|
||||
{
|
||||
T<char*> t;
|
||||
t.f(3);
|
||||
t.f("adf");
|
||||
}
|
15
gcc/testsuite/g++.old-deja/g++.pt/memtemp48.C
Normal file
15
gcc/testsuite/g++.old-deja/g++.pt/memtemp48.C
Normal file
@ -0,0 +1,15 @@
|
||||
// Build don't link:
|
||||
// GROUPS passed templates membertemplates
|
||||
struct S
|
||||
{
|
||||
template <class T>
|
||||
void f(T t1, T t = T())
|
||||
{}
|
||||
};
|
||||
|
||||
|
||||
void foo()
|
||||
{
|
||||
S si;
|
||||
si.f(3);
|
||||
}
|
16
gcc/testsuite/g++.old-deja/g++.pt/memtemp49.C
Normal file
16
gcc/testsuite/g++.old-deja/g++.pt/memtemp49.C
Normal file
@ -0,0 +1,16 @@
|
||||
// Build don't link:
|
||||
// GROUPS passed templates membertemplates
|
||||
template <class X>
|
||||
struct S
|
||||
{
|
||||
template <class T>
|
||||
void f(T t1, T t = T())
|
||||
{}
|
||||
};
|
||||
|
||||
|
||||
void foo()
|
||||
{
|
||||
S<int> si;
|
||||
si.f(3);
|
||||
}
|
25
gcc/testsuite/g++.old-deja/g++.pt/memtemp5.C
Normal file
25
gcc/testsuite/g++.old-deja/g++.pt/memtemp5.C
Normal file
@ -0,0 +1,25 @@
|
||||
// Build don't run:
|
||||
// GROUPS passed templates membertemplates
|
||||
extern "C" int printf(const char*, ...);
|
||||
|
||||
struct S {
|
||||
template <class T>
|
||||
void operator+(T);
|
||||
};
|
||||
|
||||
|
||||
template <class T>
|
||||
void S::operator+(T)
|
||||
{
|
||||
printf("Hello, world.\n");
|
||||
}
|
||||
|
||||
|
||||
|
||||
int main()
|
||||
{
|
||||
S s;
|
||||
s + 3;
|
||||
s + s;
|
||||
s.operator+("Hi");
|
||||
}
|
20
gcc/testsuite/g++.old-deja/g++.pt/memtemp52.C
Normal file
20
gcc/testsuite/g++.old-deja/g++.pt/memtemp52.C
Normal file
@ -0,0 +1,20 @@
|
||||
// Build don't link:
|
||||
// GROUPS passed templates membertemplates
|
||||
template<class T, int N>
|
||||
class A { };
|
||||
|
||||
template<int N>
|
||||
struct X {
|
||||
template<class T2, int N2>
|
||||
void f(A<T2,N>&, A<int,N2>&)
|
||||
{ }
|
||||
};
|
||||
|
||||
|
||||
void foo()
|
||||
{
|
||||
X<3> x;
|
||||
A<char*, 3> a1;
|
||||
A<int, 2> a2;
|
||||
x.f(a1, a2);
|
||||
}
|
36
gcc/testsuite/g++.old-deja/g++.pt/memtemp53.C
Normal file
36
gcc/testsuite/g++.old-deja/g++.pt/memtemp53.C
Normal file
@ -0,0 +1,36 @@
|
||||
// Build don't run:
|
||||
// GROUPS passed templates membertemplates
|
||||
template<int N>
|
||||
struct I {
|
||||
};
|
||||
|
||||
template<class T>
|
||||
struct A {
|
||||
|
||||
int r;
|
||||
|
||||
template<class T1, class T2>
|
||||
void operator()(T1, T2)
|
||||
{ r = 0; }
|
||||
|
||||
template<int N1, int N2>
|
||||
void operator()(I<N1>, I<N2>)
|
||||
{ r = 1; }
|
||||
};
|
||||
|
||||
int main()
|
||||
{
|
||||
A<float> x;
|
||||
I<0> a;
|
||||
I<1> b;
|
||||
|
||||
x(a,b);
|
||||
if (x.r != 1)
|
||||
return 1;
|
||||
|
||||
x(float(), double());
|
||||
if (x.r != 0)
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
}
|
10
gcc/testsuite/g++.old-deja/g++.pt/memtemp55.C
Normal file
10
gcc/testsuite/g++.old-deja/g++.pt/memtemp55.C
Normal file
@ -0,0 +1,10 @@
|
||||
// Build don't link:
|
||||
// GROUPS passed templates membertemplates
|
||||
template<class X> class _bz_update { };
|
||||
|
||||
template<class T>
|
||||
struct S {
|
||||
template<int N_destRank>
|
||||
void foo() { _bz_update<int>(); }
|
||||
};
|
||||
|
15
gcc/testsuite/g++.old-deja/g++.pt/memtemp56.C
Normal file
15
gcc/testsuite/g++.old-deja/g++.pt/memtemp56.C
Normal file
@ -0,0 +1,15 @@
|
||||
// Build don't link:
|
||||
// GROUPS passed templates membertemplates
|
||||
template<class P_numtype, int N_length>
|
||||
class TinyVector {};
|
||||
|
||||
template<class P_numtype, int N_rank>
|
||||
struct Array
|
||||
{
|
||||
template<int N_rank2>
|
||||
Array() {}
|
||||
|
||||
template<int N_rank2>
|
||||
P_numtype operator()(const TinyVector<int,N_rank2>& index) const {}
|
||||
};
|
||||
|
29
gcc/testsuite/g++.old-deja/g++.pt/memtemp58.C
Normal file
29
gcc/testsuite/g++.old-deja/g++.pt/memtemp58.C
Normal file
@ -0,0 +1,29 @@
|
||||
// Build don't link:
|
||||
// GROUPS passed templates membertemplates
|
||||
template<int N, class T>
|
||||
struct B {
|
||||
};
|
||||
|
||||
template<int N1, int N2, int N3>
|
||||
struct D {
|
||||
struct E {
|
||||
template<int N4, class T>
|
||||
static void f(B<N4,T>)
|
||||
{ }
|
||||
};
|
||||
};
|
||||
|
||||
template<int N>
|
||||
struct A {
|
||||
template<int N2, class T, int N3>
|
||||
static void f(B<N2,T>, B<N3,T> b)
|
||||
{
|
||||
D<N2,N3,N>::E::f(b);
|
||||
}
|
||||
};
|
||||
|
||||
void foo()
|
||||
{
|
||||
A<5>::f(B<5,float>(),B<3,float>());
|
||||
}
|
||||
|
22
gcc/testsuite/g++.old-deja/g++.pt/memtemp59.C
Normal file
22
gcc/testsuite/g++.old-deja/g++.pt/memtemp59.C
Normal file
@ -0,0 +1,22 @@
|
||||
// Build don't link:
|
||||
// GROUPS passed templates membertemplates
|
||||
template <int N>
|
||||
struct IndexPlaceholder {};
|
||||
|
||||
template <int N1, int N2, int N3>
|
||||
struct ArrayIndexMapping {};
|
||||
|
||||
template <class T_numtype, int N_rank>
|
||||
struct Array
|
||||
{
|
||||
template<int N0, int N1>
|
||||
ArrayIndexMapping<N_rank, N0, N1>
|
||||
f(IndexPlaceholder<N0>, IndexPlaceholder<N1>);
|
||||
};
|
||||
|
||||
|
||||
template <class T_numtype>
|
||||
void foo(T_numtype)
|
||||
{
|
||||
Array<T_numtype, 1> t;
|
||||
}
|
13
gcc/testsuite/g++.old-deja/g++.pt/memtemp6.C
Normal file
13
gcc/testsuite/g++.old-deja/g++.pt/memtemp6.C
Normal file
@ -0,0 +1,13 @@
|
||||
// Build don't link:
|
||||
// GROUPS passed templates membertemplates
|
||||
struct S {
|
||||
template <class T, class U>
|
||||
S(T, U, T);
|
||||
};
|
||||
|
||||
|
||||
template <class T, class U>
|
||||
S::S(T, U, T)
|
||||
{
|
||||
}
|
||||
|
22
gcc/testsuite/g++.old-deja/g++.pt/memtemp7.C
Normal file
22
gcc/testsuite/g++.old-deja/g++.pt/memtemp7.C
Normal file
@ -0,0 +1,22 @@
|
||||
// Build don't run:
|
||||
// GROUPS passed templates membertemplates
|
||||
extern "C" int printf(const char*, ...);
|
||||
|
||||
struct S {
|
||||
template <class T, class U>
|
||||
S(T, U, T);
|
||||
};
|
||||
|
||||
|
||||
template <class T, class U>
|
||||
S::S(T t1, U u1, T t2)
|
||||
{
|
||||
printf("Hello, world.\n");
|
||||
}
|
||||
|
||||
|
||||
int main()
|
||||
{
|
||||
S s1(3, "abc", 3);
|
||||
S s2('a', s1, 'a');
|
||||
}
|
13
gcc/testsuite/g++.old-deja/g++.pt/memtemp8.C
Normal file
13
gcc/testsuite/g++.old-deja/g++.pt/memtemp8.C
Normal file
@ -0,0 +1,13 @@
|
||||
// Build don't link:
|
||||
// GROUPS passed templates membertemplates
|
||||
struct S {
|
||||
template <class T>
|
||||
operator T();
|
||||
};
|
||||
|
||||
|
||||
template <class T>
|
||||
S::operator T()
|
||||
{
|
||||
}
|
||||
|
22
gcc/testsuite/g++.old-deja/g++.pt/memtemp9.C
Normal file
22
gcc/testsuite/g++.old-deja/g++.pt/memtemp9.C
Normal file
@ -0,0 +1,22 @@
|
||||
// Build don't run:
|
||||
// GROUPS passed templates membertemplates
|
||||
extern "C" int printf(const char*, ...);
|
||||
|
||||
struct S {
|
||||
template <class T>
|
||||
operator T();
|
||||
};
|
||||
|
||||
template <class T>
|
||||
S::operator T()
|
||||
{
|
||||
printf("Hello, world.\n");
|
||||
return T();
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
S s;
|
||||
|
||||
int i = s.operator int();
|
||||
}
|
Loading…
Reference in New Issue
Block a user