mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-03-06 19:07:25 +08:00
new
From-SVN: r18199
This commit is contained in:
parent
f84b4be9a7
commit
138928a696
20
gcc/testsuite/g++.old-deja/g++.other/cleanup1.C
Normal file
20
gcc/testsuite/g++.old-deja/g++.other/cleanup1.C
Normal file
@ -0,0 +1,20 @@
|
||||
// Bug: fold is too eager about pushing down CLEANUP_POINT_EXPR.
|
||||
|
||||
int d;
|
||||
|
||||
struct A {
|
||||
A() { }
|
||||
~A() { d = 1; }
|
||||
};
|
||||
|
||||
int f (const A& a)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
main ()
|
||||
{
|
||||
if (f (A()) && d == 0)
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
15
gcc/testsuite/g++.old-deja/g++.other/overcnv1.C
Normal file
15
gcc/testsuite/g++.old-deja/g++.other/overcnv1.C
Normal file
@ -0,0 +1,15 @@
|
||||
// Build don't link:
|
||||
|
||||
class A {
|
||||
public:
|
||||
void f(const char * const * );
|
||||
};
|
||||
void f(const char * const *) {}
|
||||
|
||||
void g()
|
||||
{
|
||||
char *ar[10];
|
||||
A a;
|
||||
f(ar);
|
||||
a.f(ar);
|
||||
}
|
17
gcc/testsuite/g++.old-deja/g++.pt/defarg2.C
Normal file
17
gcc/testsuite/g++.old-deja/g++.pt/defarg2.C
Normal file
@ -0,0 +1,17 @@
|
||||
template <int S=0, class T=int>
|
||||
struct X
|
||||
{};
|
||||
|
||||
template <>
|
||||
struct X<0,int>
|
||||
{};
|
||||
|
||||
template <int S>
|
||||
struct X<S,int>
|
||||
: X<>
|
||||
{};
|
||||
|
||||
int main()
|
||||
{
|
||||
X<1,int> x;
|
||||
}
|
24
gcc/testsuite/g++.old-deja/g++.pt/friend1.C
Normal file
24
gcc/testsuite/g++.old-deja/g++.pt/friend1.C
Normal file
@ -0,0 +1,24 @@
|
||||
template <class T>
|
||||
void f(T);
|
||||
|
||||
class C
|
||||
{
|
||||
template <class T>
|
||||
friend void f(T);
|
||||
|
||||
int i;
|
||||
};
|
||||
|
||||
|
||||
template <class T>
|
||||
void f(T)
|
||||
{
|
||||
C c;
|
||||
c.i = 3;
|
||||
}
|
||||
|
||||
|
||||
int main()
|
||||
{
|
||||
f(7);
|
||||
}
|
29
gcc/testsuite/g++.old-deja/g++.pt/friend10.C
Normal file
29
gcc/testsuite/g++.old-deja/g++.pt/friend10.C
Normal file
@ -0,0 +1,29 @@
|
||||
template <class T>
|
||||
void f(T);
|
||||
|
||||
template <class U>
|
||||
class C
|
||||
{
|
||||
template <class T>
|
||||
friend void f(T)
|
||||
{
|
||||
C<U> c;
|
||||
c.i = 3;
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
void g()
|
||||
{
|
||||
f(3.0);
|
||||
}
|
||||
|
||||
int i;
|
||||
};
|
||||
|
||||
int main()
|
||||
{
|
||||
f(7);
|
||||
C<double> c;
|
||||
c.g();
|
||||
}
|
31
gcc/testsuite/g++.old-deja/g++.pt/friend11.C
Normal file
31
gcc/testsuite/g++.old-deja/g++.pt/friend11.C
Normal file
@ -0,0 +1,31 @@
|
||||
template <class T>
|
||||
class C;
|
||||
|
||||
template <class T>
|
||||
struct S
|
||||
{
|
||||
template <class U>
|
||||
void f(U u)
|
||||
{
|
||||
C<U> cu;
|
||||
cu.i = 3; // ERROR - S<double>::f<U> is a friend, but this is
|
||||
// S<int>::f<double>.
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
template <class T>
|
||||
class C
|
||||
{
|
||||
template <class U>
|
||||
friend void S<T>::f(U);
|
||||
|
||||
int i;
|
||||
};
|
||||
|
||||
|
||||
int main()
|
||||
{
|
||||
S<int> si;
|
||||
si.f(3.0);
|
||||
}
|
33
gcc/testsuite/g++.old-deja/g++.pt/friend12.C
Normal file
33
gcc/testsuite/g++.old-deja/g++.pt/friend12.C
Normal file
@ -0,0 +1,33 @@
|
||||
template <class T>
|
||||
class C;
|
||||
|
||||
template <class T>
|
||||
struct S
|
||||
{
|
||||
template <class U>
|
||||
void f(U u1, U u2) {}
|
||||
|
||||
template <class U>
|
||||
void f(U u)
|
||||
{
|
||||
C<T> ct;
|
||||
ct.i = 3;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
template <class T>
|
||||
class C
|
||||
{
|
||||
template <class U>
|
||||
friend void S<T>::f(U);
|
||||
|
||||
int i;
|
||||
};
|
||||
|
||||
|
||||
int main()
|
||||
{
|
||||
S<int> si;
|
||||
si.f(3.0);
|
||||
}
|
33
gcc/testsuite/g++.old-deja/g++.pt/friend13.C
Normal file
33
gcc/testsuite/g++.old-deja/g++.pt/friend13.C
Normal file
@ -0,0 +1,33 @@
|
||||
template <class T>
|
||||
class C;
|
||||
|
||||
template <class U>
|
||||
struct S
|
||||
{
|
||||
template <class V>
|
||||
void f(V v)
|
||||
{
|
||||
C<V> cv;
|
||||
cv.i = 3;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
template <class T>
|
||||
class C
|
||||
{
|
||||
template <class U>
|
||||
template <class V>
|
||||
friend void S<U>::f(V);
|
||||
|
||||
int i;
|
||||
};
|
||||
|
||||
|
||||
int main()
|
||||
{
|
||||
S<int> si;
|
||||
si.f(3.0);
|
||||
S<long> sl;
|
||||
sl.f('c');
|
||||
}
|
25
gcc/testsuite/g++.old-deja/g++.pt/friend3.C
Normal file
25
gcc/testsuite/g++.old-deja/g++.pt/friend3.C
Normal file
@ -0,0 +1,25 @@
|
||||
// Build don't link:
|
||||
|
||||
template <class T>
|
||||
void f(T);
|
||||
|
||||
class C
|
||||
{
|
||||
friend void f<>(double);
|
||||
|
||||
int i;
|
||||
};
|
||||
|
||||
|
||||
template <class T>
|
||||
void f(T)
|
||||
{
|
||||
C c;
|
||||
c.i = 3; // ERROR - f<double> is a friend, this is f<int>.
|
||||
}
|
||||
|
||||
|
||||
int main()
|
||||
{
|
||||
f(7);
|
||||
}
|
21
gcc/testsuite/g++.old-deja/g++.pt/friend4.C
Normal file
21
gcc/testsuite/g++.old-deja/g++.pt/friend4.C
Normal file
@ -0,0 +1,21 @@
|
||||
class C
|
||||
{
|
||||
template <class T>
|
||||
friend void f(T);
|
||||
|
||||
int i;
|
||||
};
|
||||
|
||||
|
||||
template <class T>
|
||||
void f(T)
|
||||
{
|
||||
C c;
|
||||
c.i = 3;
|
||||
}
|
||||
|
||||
|
||||
int main()
|
||||
{
|
||||
f(7);
|
||||
}
|
17
gcc/testsuite/g++.old-deja/g++.pt/friend5.C
Normal file
17
gcc/testsuite/g++.old-deja/g++.pt/friend5.C
Normal file
@ -0,0 +1,17 @@
|
||||
class C
|
||||
{
|
||||
template <class T>
|
||||
friend void f(T)
|
||||
{
|
||||
C c;
|
||||
c.i = 3;
|
||||
}
|
||||
|
||||
int i;
|
||||
};
|
||||
|
||||
|
||||
int main()
|
||||
{
|
||||
f(7);
|
||||
}
|
28
gcc/testsuite/g++.old-deja/g++.pt/friend6.C
Normal file
28
gcc/testsuite/g++.old-deja/g++.pt/friend6.C
Normal file
@ -0,0 +1,28 @@
|
||||
template <class T>
|
||||
void f(T);
|
||||
|
||||
class C
|
||||
{
|
||||
template <class T>
|
||||
friend void f(T)
|
||||
{
|
||||
C c;
|
||||
c.i = 3;
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
void g()
|
||||
{
|
||||
f(3.0);
|
||||
}
|
||||
|
||||
int i;
|
||||
};
|
||||
|
||||
int main()
|
||||
{
|
||||
f(7);
|
||||
C c;
|
||||
c.g();
|
||||
}
|
25
gcc/testsuite/g++.old-deja/g++.pt/friend7.C
Normal file
25
gcc/testsuite/g++.old-deja/g++.pt/friend7.C
Normal file
@ -0,0 +1,25 @@
|
||||
template <class T>
|
||||
void f(T);
|
||||
|
||||
template <class U>
|
||||
class C
|
||||
{
|
||||
template <class T>
|
||||
friend void f(T);
|
||||
|
||||
int i;
|
||||
};
|
||||
|
||||
|
||||
template <class T>
|
||||
void f(T)
|
||||
{
|
||||
C<T> c;
|
||||
c.i = 3;
|
||||
}
|
||||
|
||||
|
||||
int main()
|
||||
{
|
||||
f(7);
|
||||
}
|
18
gcc/testsuite/g++.old-deja/g++.pt/friend8.C
Normal file
18
gcc/testsuite/g++.old-deja/g++.pt/friend8.C
Normal file
@ -0,0 +1,18 @@
|
||||
template <class T>
|
||||
class C
|
||||
{
|
||||
friend void f (C<T> c)
|
||||
{
|
||||
c.i = 3;
|
||||
}
|
||||
|
||||
int i;
|
||||
};
|
||||
|
||||
|
||||
int main()
|
||||
{
|
||||
C<int> ci;
|
||||
|
||||
f(ci);
|
||||
}
|
22
gcc/testsuite/g++.old-deja/g++.pt/friend9.C
Normal file
22
gcc/testsuite/g++.old-deja/g++.pt/friend9.C
Normal file
@ -0,0 +1,22 @@
|
||||
template <class U>
|
||||
class C
|
||||
{
|
||||
template <class T>
|
||||
friend void f(T);
|
||||
|
||||
int i;
|
||||
};
|
||||
|
||||
|
||||
template <class T>
|
||||
void f(T)
|
||||
{
|
||||
C<int> c;
|
||||
c.i = 3;
|
||||
}
|
||||
|
||||
|
||||
int main()
|
||||
{
|
||||
f(7);
|
||||
}
|
12
gcc/testsuite/g++.old-deja/g++.pt/instantiate2.C
Normal file
12
gcc/testsuite/g++.old-deja/g++.pt/instantiate2.C
Normal file
@ -0,0 +1,12 @@
|
||||
// Build don't link:
|
||||
|
||||
template<class T>
|
||||
struct X_two {
|
||||
template <class T2> T2 conv_compare_ge(T2 test) {
|
||||
T2 tmp_value = T2 (0);
|
||||
return (tmp_value > test ? tmp_value : test);
|
||||
}
|
||||
};
|
||||
|
||||
template int X_two<double>::conv_compare_ge(int);
|
||||
|
@ -18,7 +18,8 @@ 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);
|
||||
typedef typename D<N2,N3,N>::E E;
|
||||
E::f(b);
|
||||
}
|
||||
};
|
||||
|
||||
|
24
gcc/testsuite/g++.old-deja/g++.pt/memtemp70.C
Normal file
24
gcc/testsuite/g++.old-deja/g++.pt/memtemp70.C
Normal file
@ -0,0 +1,24 @@
|
||||
// Build don't link:
|
||||
|
||||
template <class T>
|
||||
class X {
|
||||
public:
|
||||
T x;
|
||||
};
|
||||
|
||||
class Y {
|
||||
public:
|
||||
template <class T> static void f(X<T>& a) {}
|
||||
|
||||
void g(void);
|
||||
};
|
||||
|
||||
void
|
||||
Y::g(void)
|
||||
{
|
||||
X<int> a;
|
||||
|
||||
f(a);
|
||||
}
|
||||
|
||||
|
21
gcc/testsuite/g++.old-deja/g++.pt/ttp42.C
Normal file
21
gcc/testsuite/g++.old-deja/g++.pt/ttp42.C
Normal file
@ -0,0 +1,21 @@
|
||||
template <class T, template <class T> class C>
|
||||
struct X
|
||||
{};
|
||||
|
||||
template <class T>
|
||||
struct Y
|
||||
{};
|
||||
|
||||
template <class T>
|
||||
struct Z
|
||||
{};
|
||||
|
||||
template <class T>
|
||||
struct X<T,Y>
|
||||
{};
|
||||
|
||||
int main()
|
||||
{
|
||||
X<int,Y> a;
|
||||
X<int,Z> b;
|
||||
}
|
Loading…
Reference in New Issue
Block a user