new, update
From-SVN: r19649
This commit is contained in:
parent
f283421d4a
commit
6e940d05f4
52 changed files with 451 additions and 45 deletions
|
@ -1,13 +1,10 @@
|
|||
// g++ 1.37.1 bug 900404_04
|
||||
|
||||
// The ANSI C does not allow vacuous statements (i.e. just semicolons)
|
||||
// at the file-scope level.
|
||||
|
||||
// The current C++ Reference Manual does not indicate whether these should
|
||||
// be considered legal or not.
|
||||
|
||||
// I am forced to conclude that C++ will follow ANSI C in this regard,
|
||||
// and that these are therefore not legal.
|
||||
// [dcl.dcl] explains that simple-declarations may omit the
|
||||
// init-declarator-list only if the decl-specifier-seq declares a
|
||||
// class, i.e. if it contains a class-specifier, an
|
||||
// elaborated-type-specifier with class key, or an enum-specifier. The
|
||||
// declaration below contains neither.
|
||||
|
||||
// g++ fails to flag errors for such usage.
|
||||
|
||||
|
|
|
@ -33,6 +33,6 @@ eh_test (int level)
|
|||
|
||||
main ()
|
||||
{
|
||||
set_terminate (&eh_terminate);
|
||||
std::set_terminate (&eh_terminate);
|
||||
eh_test (0);
|
||||
}
|
||||
|
|
|
@ -8,15 +8,15 @@ void my_term () { exit (1); }
|
|||
void my_unexp () { throw 42; }
|
||||
|
||||
void
|
||||
f () throw (char, int, bad_exception)
|
||||
f () throw (char, int, std::bad_exception)
|
||||
{
|
||||
throw 'a';
|
||||
}
|
||||
|
||||
main ()
|
||||
{
|
||||
set_terminate (my_term);
|
||||
set_unexpected (my_unexp);
|
||||
std::set_terminate (my_term);
|
||||
std::set_unexpected (my_unexp);
|
||||
|
||||
try
|
||||
{
|
||||
|
@ -30,7 +30,7 @@ main ()
|
|||
{
|
||||
return 3;
|
||||
}
|
||||
catch (bad_exception)
|
||||
catch (std::bad_exception)
|
||||
{
|
||||
return 4;
|
||||
}
|
||||
|
|
|
@ -8,15 +8,15 @@ void my_term () { exit (1); }
|
|||
void my_unexp () { throw 42; }
|
||||
|
||||
void
|
||||
f () throw (int, bad_exception)
|
||||
f () throw (int, std::bad_exception)
|
||||
{
|
||||
throw 'a';
|
||||
}
|
||||
|
||||
main ()
|
||||
{
|
||||
set_terminate (my_term);
|
||||
set_unexpected (my_unexp);
|
||||
std::set_terminate (my_term);
|
||||
std::set_unexpected (my_unexp);
|
||||
|
||||
try
|
||||
{
|
||||
|
@ -30,7 +30,7 @@ main ()
|
|||
{
|
||||
return 0;
|
||||
}
|
||||
catch (bad_exception)
|
||||
catch (std::bad_exception)
|
||||
{
|
||||
return 4;
|
||||
}
|
||||
|
|
|
@ -8,15 +8,15 @@ void my_term () { exit (1); }
|
|||
void my_unexp () { throw 42; }
|
||||
|
||||
void
|
||||
f () throw (bad_exception)
|
||||
f () throw (std::bad_exception)
|
||||
{
|
||||
throw 'a';
|
||||
}
|
||||
|
||||
main ()
|
||||
{
|
||||
set_terminate (my_term);
|
||||
set_unexpected (my_unexp);
|
||||
std::set_terminate (my_term);
|
||||
std::set_unexpected (my_unexp);
|
||||
|
||||
try
|
||||
{
|
||||
|
@ -30,7 +30,7 @@ main ()
|
|||
{
|
||||
return 3;
|
||||
}
|
||||
catch (bad_exception)
|
||||
catch (std::bad_exception)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -15,8 +15,8 @@ f () throw (short)
|
|||
|
||||
main ()
|
||||
{
|
||||
set_terminate (my_term);
|
||||
set_unexpected (my_unexp);
|
||||
std::set_terminate (my_term);
|
||||
std::set_unexpected (my_unexp);
|
||||
|
||||
try
|
||||
{
|
||||
|
@ -30,7 +30,7 @@ main ()
|
|||
{
|
||||
return 3;
|
||||
}
|
||||
catch (bad_exception)
|
||||
catch (std::bad_exception)
|
||||
{
|
||||
return 4;
|
||||
}
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
#include <iostream.h>
|
||||
#include <vector>
|
||||
|
||||
using std::vector;
|
||||
|
||||
class Component {
|
||||
int george;
|
||||
|
@ -34,5 +36,5 @@ main(int argc, char**argv) {
|
|||
exit(0);
|
||||
}
|
||||
|
||||
template class __malloc_alloc_template<0>;
|
||||
template class __default_alloc_template<false, 0>;
|
||||
template class std::__malloc_alloc_template<0>;
|
||||
template class std::__default_alloc_template<false, 0>;
|
||||
|
|
|
@ -5,7 +5,7 @@ struct foo { double f(int); };
|
|||
|
||||
main() {
|
||||
double f (int);
|
||||
const type_info &r = typeid (f);
|
||||
const std::type_info &r = typeid (f);
|
||||
cout << typeid(f).name() << endl;
|
||||
cout << typeid(foo::f).name() << endl;
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@ int FLAG=0;
|
|||
|
||||
extern "C" int printf( const char *, ...);
|
||||
|
||||
void * operator new(size_t, const nothrow_t&) throw() { FLAG=1; return 0; }
|
||||
void * operator new(size_t, const std::nothrow_t&) throw() { FLAG=1; return 0; }
|
||||
|
||||
class K {
|
||||
private:
|
||||
|
@ -24,7 +24,7 @@ public:
|
|||
|
||||
int main(void)
|
||||
{
|
||||
K * pK = new (nothrow) K( 10);
|
||||
K * pK = new (std::nothrow) K( 10);
|
||||
if ( FLAG != 1 )
|
||||
printf ("FAIL\n");
|
||||
else
|
||||
|
|
|
@ -15,7 +15,7 @@ main() {
|
|||
B b;
|
||||
try {
|
||||
(void)dynamic_cast<D&>(b);
|
||||
} catch (bad_cast) {
|
||||
} catch (std::bad_cast) {
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
|
|
|
@ -18,7 +18,7 @@ main() {
|
|||
try {
|
||||
void *vp = &dynamic_cast<D&>(*b);
|
||||
return 1;
|
||||
} catch (bad_cast) {
|
||||
} catch (std::bad_cast) {
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
|
|
|
@ -21,7 +21,7 @@ int main() {
|
|||
try {
|
||||
B b;
|
||||
x (b);
|
||||
} catch (exception& e) {
|
||||
} catch (std::exception& e) {
|
||||
// If we get a bad_cast, it is wrong.
|
||||
return 1;
|
||||
}
|
||||
|
|
|
@ -36,7 +36,7 @@ void my_terminate() {
|
|||
}
|
||||
|
||||
main() {
|
||||
set_terminate (my_terminate);
|
||||
std::set_terminate (my_terminate);
|
||||
try {
|
||||
bar();
|
||||
} catch (...) {
|
||||
|
|
|
@ -10,7 +10,7 @@ void my_terminate() {
|
|||
struct A {
|
||||
A() { }
|
||||
~A() {
|
||||
set_terminate (my_terminate);
|
||||
std::set_terminate (my_terminate);
|
||||
throw 1; // This throws from EH dtor, should call my_terminate
|
||||
}
|
||||
};
|
||||
|
|
|
@ -10,7 +10,7 @@ void my_unexpected() {
|
|||
foo() throw (int) { throw "Hi"; }
|
||||
|
||||
main() {
|
||||
set_unexpected (my_unexpected);
|
||||
std::set_unexpected (my_unexpected);
|
||||
try {
|
||||
foo();
|
||||
} catch (int i) {
|
||||
|
|
|
@ -10,7 +10,7 @@ void my_unexpected() {
|
|||
foo() throw () { throw "Hi"; }
|
||||
|
||||
main() {
|
||||
set_unexpected (my_unexpected);
|
||||
std::set_unexpected (my_unexpected);
|
||||
foo();
|
||||
return 1;
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ main() {
|
|||
} catch (...) {
|
||||
}
|
||||
try {
|
||||
set_terminate (myterm);
|
||||
std::set_terminate (myterm);
|
||||
throw;
|
||||
} catch (...) {
|
||||
return 1;
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
// excess errors test - XFAIL a29k-*-* sparc64-*-elf sh-*-* arm-*-pe**-*
|
||||
|
||||
#include <exception>
|
||||
|
||||
using std::uncaught_exception;
|
||||
class A {
|
||||
public:
|
||||
~A() {
|
||||
|
|
|
@ -10,7 +10,7 @@ void my_unexpected() {
|
|||
template <class T> int foo(T) throw (int) { throw "Hi"; }
|
||||
|
||||
main() {
|
||||
set_unexpected (my_unexpected);
|
||||
std::set_unexpected (my_unexpected);
|
||||
try {
|
||||
foo(1);
|
||||
} catch (int i) {
|
||||
|
|
|
@ -10,7 +10,7 @@ void my_unexpected() {
|
|||
template <class T> int foo(T) throw (T) { throw "Hi"; }
|
||||
|
||||
main() {
|
||||
set_unexpected (my_unexpected);
|
||||
std::set_unexpected (my_unexpected);
|
||||
try {
|
||||
foo(1);
|
||||
} catch (int i) {
|
||||
|
|
|
@ -12,7 +12,7 @@ void throw_an_unexpected_exception() throw() {
|
|||
}
|
||||
|
||||
int main() {
|
||||
set_terminate(my_terminate_handler);
|
||||
std::set_terminate(my_terminate_handler);
|
||||
throw_an_unexpected_exception();
|
||||
return 1;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
// excess errors test - XFAIL *-*-*
|
||||
class Foo {
|
||||
};
|
||||
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
// Build don't link:
|
||||
// excess errors test - XFAIL *-*-*
|
||||
|
||||
namespace N {
|
||||
struct C {
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
// Build don't link:
|
||||
// excess errors test - XFAIL *-*-*
|
||||
|
||||
namespace Jazz {
|
||||
int horn( int h ) { return 1; }
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
// excess errors test - XFAIL *-*-*
|
||||
namespace Foo {
|
||||
bar() {
|
||||
return 0;
|
||||
|
|
18
gcc/testsuite/g++.old-deja/g++.ns/alias1.C
Normal file
18
gcc/testsuite/g++.old-deja/g++.ns/alias1.C
Normal file
|
@ -0,0 +1,18 @@
|
|||
namespace foo{
|
||||
int eine_funktion(int)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
namespace foo{
|
||||
void eine_funktion(int,int)
|
||||
{}
|
||||
}
|
||||
|
||||
namespace bar = foo;
|
||||
|
||||
int main()
|
||||
{
|
||||
return bar::eine_funktion(3);
|
||||
}
|
18
gcc/testsuite/g++.old-deja/g++.ns/koenig1.C
Normal file
18
gcc/testsuite/g++.old-deja/g++.ns/koenig1.C
Normal file
|
@ -0,0 +1,18 @@
|
|||
// Build don't link:
|
||||
class ostream;
|
||||
extern ostream cout;
|
||||
namespace foo
|
||||
{
|
||||
struct S
|
||||
{
|
||||
int i;
|
||||
};
|
||||
|
||||
extern ostream &operator<<(ostream &, const S &);
|
||||
}
|
||||
|
||||
|
||||
void bar(foo::S s)
|
||||
{
|
||||
cout << s ;
|
||||
}
|
3
gcc/testsuite/g++.old-deja/g++.ns/lookup1.C
Normal file
3
gcc/testsuite/g++.old-deja/g++.ns/lookup1.C
Normal file
|
@ -0,0 +1,3 @@
|
|||
// Build don't link:
|
||||
typedef int __quad_t;
|
||||
typedef __quad_t __qaddr_t;
|
9
gcc/testsuite/g++.old-deja/g++.ns/lookup2.C
Normal file
9
gcc/testsuite/g++.old-deja/g++.ns/lookup2.C
Normal file
|
@ -0,0 +1,9 @@
|
|||
// Build don't link:
|
||||
template <class charT>
|
||||
struct basic_string
|
||||
{
|
||||
charT append (charT c)
|
||||
{ return c; }
|
||||
};
|
||||
typedef char c;
|
||||
template class basic_string <char>;
|
16
gcc/testsuite/g++.old-deja/g++.ns/ns1.C
Normal file
16
gcc/testsuite/g++.old-deja/g++.ns/ns1.C
Normal file
|
@ -0,0 +1,16 @@
|
|||
namespace foo{
|
||||
int eine_funktion(int)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int eine_funktion(int,int)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
main(int,char**)
|
||||
{
|
||||
return foo::eine_funktion(1);
|
||||
}
|
13
gcc/testsuite/g++.old-deja/g++.ns/ns10.C
Normal file
13
gcc/testsuite/g++.old-deja/g++.ns/ns10.C
Normal file
|
@ -0,0 +1,13 @@
|
|||
//Build don't link:
|
||||
namespace bb
|
||||
{
|
||||
int f(int);
|
||||
|
||||
namespace k
|
||||
{
|
||||
void foo(int bar)
|
||||
{
|
||||
int i=bb:f(bar); // ERROR - namespace
|
||||
}
|
||||
}
|
||||
}
|
19
gcc/testsuite/g++.old-deja/g++.ns/ns11.C
Normal file
19
gcc/testsuite/g++.old-deja/g++.ns/ns11.C
Normal file
|
@ -0,0 +1,19 @@
|
|||
// Build don't link
|
||||
// Check [namespace.memdef]/2
|
||||
|
||||
namespace A{
|
||||
void f(int);
|
||||
void f(int,int);
|
||||
int i; // ERROR - .*
|
||||
}
|
||||
|
||||
void A::f(){} // ERROR - should have been declared before
|
||||
|
||||
namespace B{
|
||||
void A::f(int){} // ERROR - B does not surround A
|
||||
}
|
||||
|
||||
int A::i; // ERROR - redefinition
|
||||
|
||||
void A::f(int,int){} // ok
|
||||
|
22
gcc/testsuite/g++.old-deja/g++.ns/ns12.C
Normal file
22
gcc/testsuite/g++.old-deja/g++.ns/ns12.C
Normal file
|
@ -0,0 +1,22 @@
|
|||
namespace fred
|
||||
{
|
||||
int barney();
|
||||
extern int wilma;
|
||||
}
|
||||
|
||||
int fred::barney()
|
||||
{
|
||||
return fred::wilma;
|
||||
}
|
||||
|
||||
int fred::wilma;
|
||||
|
||||
int barney()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
main()
|
||||
{
|
||||
return fred::barney();
|
||||
}
|
26
gcc/testsuite/g++.old-deja/g++.ns/ns2.C
Normal file
26
gcc/testsuite/g++.old-deja/g++.ns/ns2.C
Normal file
|
@ -0,0 +1,26 @@
|
|||
namespace foo{
|
||||
struct X{
|
||||
int i;
|
||||
void f();
|
||||
static int k1,k2;
|
||||
};
|
||||
void X::f(){}
|
||||
int var;
|
||||
int X::k1;
|
||||
}
|
||||
|
||||
using namespace foo;
|
||||
X zzz;
|
||||
int X::k2;
|
||||
|
||||
void andere_funktion()
|
||||
{
|
||||
zzz.f();
|
||||
var=4;
|
||||
}
|
||||
|
||||
main(int,char**)
|
||||
{
|
||||
andere_funktion();
|
||||
return 0;
|
||||
}
|
17
gcc/testsuite/g++.old-deja/g++.ns/ns3.C
Normal file
17
gcc/testsuite/g++.old-deja/g++.ns/ns3.C
Normal file
|
@ -0,0 +1,17 @@
|
|||
// Build don't link:
|
||||
namespace foo{
|
||||
void eine_funktion(int)
|
||||
{}
|
||||
}
|
||||
|
||||
using namespace foo;
|
||||
|
||||
namespace foo{
|
||||
void eine_funktion(int,int)
|
||||
{}
|
||||
}
|
||||
|
||||
void andere_funktion()
|
||||
{
|
||||
eine_funktion(3,4);
|
||||
}
|
11
gcc/testsuite/g++.old-deja/g++.ns/ns4.C
Normal file
11
gcc/testsuite/g++.old-deja/g++.ns/ns4.C
Normal file
|
@ -0,0 +1,11 @@
|
|||
// Build don't link:
|
||||
namespace A{
|
||||
enum foo{a,b,c};
|
||||
}
|
||||
using A::foo;
|
||||
using A::b;
|
||||
void g()
|
||||
{
|
||||
foo x;
|
||||
x=b;
|
||||
}
|
6
gcc/testsuite/g++.old-deja/g++.ns/ns5.C
Normal file
6
gcc/testsuite/g++.old-deja/g++.ns/ns5.C
Normal file
|
@ -0,0 +1,6 @@
|
|||
// Build don't link:
|
||||
namespace X{
|
||||
class Y{};
|
||||
}
|
||||
|
||||
X::Y z;
|
13
gcc/testsuite/g++.old-deja/g++.ns/ns6.C
Normal file
13
gcc/testsuite/g++.old-deja/g++.ns/ns6.C
Normal file
|
@ -0,0 +1,13 @@
|
|||
namespace A{
|
||||
int i;
|
||||
namespace B{
|
||||
void f(){i++;}
|
||||
int i;
|
||||
void g(){i++;}
|
||||
}
|
||||
}
|
||||
|
||||
main()
|
||||
{
|
||||
return A::i-A::B::i;
|
||||
}
|
26
gcc/testsuite/g++.old-deja/g++.ns/ns7.C
Normal file
26
gcc/testsuite/g++.old-deja/g++.ns/ns7.C
Normal file
|
@ -0,0 +1,26 @@
|
|||
// Build don't link:
|
||||
namespace A{
|
||||
struct X{
|
||||
int i;
|
||||
X(){}
|
||||
X(int j);
|
||||
void operator=(const X&);
|
||||
virtual ~X(){}
|
||||
};
|
||||
void X::operator=(const X&o)
|
||||
{
|
||||
i=o.i;
|
||||
}
|
||||
}
|
||||
|
||||
A::X::X(int j):i(j){}
|
||||
|
||||
namespace A{
|
||||
struct Y:public X{
|
||||
int j;
|
||||
Y(int,int);
|
||||
};
|
||||
}
|
||||
|
||||
A::Y::Y(int a,int b):X(a),j(b)
|
||||
{}
|
11
gcc/testsuite/g++.old-deja/g++.ns/ns8.C
Normal file
11
gcc/testsuite/g++.old-deja/g++.ns/ns8.C
Normal file
|
@ -0,0 +1,11 @@
|
|||
// Build don't link:
|
||||
namespace B{
|
||||
void f();
|
||||
}
|
||||
|
||||
using namespace B;
|
||||
|
||||
void g()
|
||||
{
|
||||
::f();
|
||||
}
|
13
gcc/testsuite/g++.old-deja/g++.ns/ns9.C
Normal file
13
gcc/testsuite/g++.old-deja/g++.ns/ns9.C
Normal file
|
@ -0,0 +1,13 @@
|
|||
// Build don't link:
|
||||
namespace bb
|
||||
{
|
||||
int f(int);
|
||||
|
||||
namespace k
|
||||
{
|
||||
void foo(int bar)
|
||||
{
|
||||
return bb:f(bar); //ERROR - syntax error
|
||||
}
|
||||
}
|
||||
}
|
33
gcc/testsuite/g++.old-deja/g++.ns/overload1.C
Normal file
33
gcc/testsuite/g++.old-deja/g++.ns/overload1.C
Normal file
|
@ -0,0 +1,33 @@
|
|||
// Unqualified lookup should find all functions.
|
||||
// Duplicates are ignored as long as they lose during overload resolution.
|
||||
namespace A{
|
||||
int f(){
|
||||
return 1;
|
||||
}
|
||||
int f(double);
|
||||
}
|
||||
namespace B{
|
||||
int f(int){
|
||||
return 2;
|
||||
}
|
||||
int f(double);
|
||||
}
|
||||
|
||||
int f(int,int)
|
||||
{
|
||||
return 3;
|
||||
}
|
||||
|
||||
using namespace A;
|
||||
using namespace B;
|
||||
|
||||
main()
|
||||
{
|
||||
if(f() != 1)
|
||||
return 1;
|
||||
if(f(1) != 2)
|
||||
return 1;
|
||||
if(f(0,0) != 3)
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
12
gcc/testsuite/g++.old-deja/g++.ns/overload2.C
Normal file
12
gcc/testsuite/g++.old-deja/g++.ns/overload2.C
Normal file
|
@ -0,0 +1,12 @@
|
|||
namespace A{
|
||||
void f(); // ERROR - .*
|
||||
}
|
||||
|
||||
using namespace A;
|
||||
|
||||
void f(); // ERROR - .*
|
||||
|
||||
void g()
|
||||
{
|
||||
f(); // ERROR - ambiguous, ::f or A::f ?
|
||||
}
|
19
gcc/testsuite/g++.old-deja/g++.ns/overload3.C
Normal file
19
gcc/testsuite/g++.old-deja/g++.ns/overload3.C
Normal file
|
@ -0,0 +1,19 @@
|
|||
// Build don't link:
|
||||
// Declarations after the first one don't affect the set of used decls.
|
||||
|
||||
namespace A{
|
||||
void f(); // ERROR - .*
|
||||
}
|
||||
|
||||
using A::f;
|
||||
|
||||
namespace A{
|
||||
void f(int);
|
||||
}
|
||||
|
||||
using A::f;
|
||||
|
||||
void g()
|
||||
{
|
||||
f(4); // ERROR - too many arguments
|
||||
}
|
8
gcc/testsuite/g++.old-deja/g++.ns/overload4.C
Normal file
8
gcc/testsuite/g++.old-deja/g++.ns/overload4.C
Normal file
|
@ -0,0 +1,8 @@
|
|||
// Build don't link:
|
||||
namespace A{
|
||||
void f(); // ERROR - .*
|
||||
}
|
||||
|
||||
using A::f;
|
||||
void f(); // ERROR - duplicate declaration
|
||||
|
14
gcc/testsuite/g++.old-deja/g++.ns/overload5.C
Normal file
14
gcc/testsuite/g++.old-deja/g++.ns/overload5.C
Normal file
|
@ -0,0 +1,14 @@
|
|||
// Build don't link:
|
||||
namespace A{
|
||||
void f(){} // ERROR - previous declaration
|
||||
}
|
||||
|
||||
using A::f;
|
||||
|
||||
void f(int);
|
||||
void f(){} // ERROR - conflict
|
||||
|
||||
void g()
|
||||
{
|
||||
f(4);
|
||||
}
|
9
gcc/testsuite/g++.old-deja/g++.ns/template1.C
Normal file
9
gcc/testsuite/g++.old-deja/g++.ns/template1.C
Normal file
|
@ -0,0 +1,9 @@
|
|||
// Build don't link:
|
||||
namespace foo {
|
||||
|
||||
template <class T>
|
||||
class x {};
|
||||
|
||||
}
|
||||
|
||||
foo::x<int> y;
|
14
gcc/testsuite/g++.old-deja/g++.ns/template2.C
Normal file
14
gcc/testsuite/g++.old-deja/g++.ns/template2.C
Normal file
|
@ -0,0 +1,14 @@
|
|||
//Build don't link:
|
||||
//Inheritance from templates which are namespace members
|
||||
namespace foo {
|
||||
|
||||
template <class T>
|
||||
struct x {
|
||||
x(){}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
class y : public foo::x<int> {};
|
||||
|
||||
y r;
|
3
gcc/testsuite/g++.old-deja/g++.ns/using1.C
Normal file
3
gcc/testsuite/g++.old-deja/g++.ns/using1.C
Normal file
|
@ -0,0 +1,3 @@
|
|||
// Build don't link:
|
||||
using namespace bb; // ERROR - .*
|
||||
|
5
gcc/testsuite/g++.old-deja/g++.ns/using2.C
Normal file
5
gcc/testsuite/g++.old-deja/g++.ns/using2.C
Normal file
|
@ -0,0 +1,5 @@
|
|||
// Build don't link:
|
||||
void f();
|
||||
namespace A{
|
||||
using ::f;
|
||||
}
|
40
gcc/testsuite/g++.old-deja/g++.other/temporary1.C
Normal file
40
gcc/testsuite/g++.old-deja/g++.other/temporary1.C
Normal file
|
@ -0,0 +1,40 @@
|
|||
extern "C" int printf(char*, ...);
|
||||
|
||||
int c, d;
|
||||
class Foo
|
||||
{
|
||||
public:
|
||||
Foo() { printf("Foo() 0x%08lx\n", (unsigned long)this); ++c; }
|
||||
Foo(Foo const &) { printf("Foo(Foo const &) 0x%08lx\n", (unsigned long)this); }
|
||||
~Foo() { printf("~Foo() 0x%08lx\n", (unsigned long)this); ++d; }
|
||||
};
|
||||
|
||||
// Bar creates constructs a temporary Foo() as a default
|
||||
class Bar
|
||||
{
|
||||
public:
|
||||
Bar(Foo const & = Foo()) { printf("Bar(Foo const &) 0x%08lx\n", (unsigned long)this); }
|
||||
};
|
||||
|
||||
void fakeRef(Bar *)
|
||||
{
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
// Create array of Bar. Will use default argument on constructor.
|
||||
// The old compiler will loop constructing Bar. Each loop will
|
||||
// construct a temporary Foo() but will not destruct the Foo().
|
||||
// The Foo() temporary is destructed only once after the loop
|
||||
// completes. This could lead to a memory leak if the constructor
|
||||
// of Foo() allocates memory.
|
||||
Bar bar[2];
|
||||
|
||||
fakeRef(bar);
|
||||
|
||||
printf("Done\n");
|
||||
|
||||
if (c == d && c == 2)
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
13
gcc/testsuite/g++.old-deja/g++.pt/scope1.C
Normal file
13
gcc/testsuite/g++.old-deja/g++.pt/scope1.C
Normal file
|
@ -0,0 +1,13 @@
|
|||
// Build don't link:
|
||||
|
||||
template<class X, class Z>
|
||||
class foo
|
||||
{
|
||||
public:
|
||||
typedef X y;
|
||||
|
||||
class bar {
|
||||
public:
|
||||
void blah () { y Y; }
|
||||
};
|
||||
};
|
Loading…
Add table
Reference in a new issue