diff options
author | Jason Merrill <jason@gcc.gnu.org> | 1998-05-09 14:08:52 -0400 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 1998-05-09 14:08:52 -0400 |
commit | 6e940d05f48d784783f1a8ce79bba3a47a2263a2 (patch) | |
tree | c1af93d323ef7ed6a59421f32af50e66d5771024 /gcc | |
parent | f283421d4a4c4f1a81b861d552ed2851991886be (diff) | |
download | gcc-6e940d05f48d784783f1a8ce79bba3a47a2263a2.zip gcc-6e940d05f48d784783f1a8ce79bba3a47a2263a2.tar.gz gcc-6e940d05f48d784783f1a8ce79bba3a47a2263a2.tar.bz2 |
new, update
From-SVN: r19649
Diffstat (limited to 'gcc')
52 files changed, 451 insertions, 45 deletions
diff --git a/gcc/testsuite/g++.old-deja/g++.bugs/900404_04.C b/gcc/testsuite/g++.old-deja/g++.bugs/900404_04.C index b6d4830..75be8ab 100644 --- a/gcc/testsuite/g++.old-deja/g++.bugs/900404_04.C +++ b/gcc/testsuite/g++.old-deja/g++.bugs/900404_04.C @@ -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. diff --git a/gcc/testsuite/g++.old-deja/g++.eh/rethrow3.C b/gcc/testsuite/g++.old-deja/g++.eh/rethrow3.C index 355bedc..bea447b 100644 --- a/gcc/testsuite/g++.old-deja/g++.eh/rethrow3.C +++ b/gcc/testsuite/g++.old-deja/g++.eh/rethrow3.C @@ -33,6 +33,6 @@ eh_test (int level) main () { - set_terminate (&eh_terminate); + std::set_terminate (&eh_terminate); eh_test (0); } diff --git a/gcc/testsuite/g++.old-deja/g++.eh/spec1.C b/gcc/testsuite/g++.old-deja/g++.eh/spec1.C index 73ee960..8f45070 100644 --- a/gcc/testsuite/g++.old-deja/g++.eh/spec1.C +++ b/gcc/testsuite/g++.old-deja/g++.eh/spec1.C @@ -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; } diff --git a/gcc/testsuite/g++.old-deja/g++.eh/spec2.C b/gcc/testsuite/g++.old-deja/g++.eh/spec2.C index 4401377..41774bf 100644 --- a/gcc/testsuite/g++.old-deja/g++.eh/spec2.C +++ b/gcc/testsuite/g++.old-deja/g++.eh/spec2.C @@ -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; } diff --git a/gcc/testsuite/g++.old-deja/g++.eh/spec3.C b/gcc/testsuite/g++.old-deja/g++.eh/spec3.C index 148be76..602cd6f 100644 --- a/gcc/testsuite/g++.old-deja/g++.eh/spec3.C +++ b/gcc/testsuite/g++.old-deja/g++.eh/spec3.C @@ -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; } diff --git a/gcc/testsuite/g++.old-deja/g++.eh/spec4.C b/gcc/testsuite/g++.old-deja/g++.eh/spec4.C index d8b8ce7..adcf675 100644 --- a/gcc/testsuite/g++.old-deja/g++.eh/spec4.C +++ b/gcc/testsuite/g++.old-deja/g++.eh/spec4.C @@ -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; } diff --git a/gcc/testsuite/g++.old-deja/g++.jason/template31.C b/gcc/testsuite/g++.old-deja/g++.jason/template31.C index 8870bf4..fdea9d6 100644 --- a/gcc/testsuite/g++.old-deja/g++.jason/template31.C +++ b/gcc/testsuite/g++.old-deja/g++.jason/template31.C @@ -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>; diff --git a/gcc/testsuite/g++.old-deja/g++.jason/typeid1.C b/gcc/testsuite/g++.old-deja/g++.jason/typeid1.C index 90eeb45..f7fcbae 100644 --- a/gcc/testsuite/g++.old-deja/g++.jason/typeid1.C +++ b/gcc/testsuite/g++.old-deja/g++.jason/typeid1.C @@ -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; } diff --git a/gcc/testsuite/g++.old-deja/g++.law/operators27.C b/gcc/testsuite/g++.old-deja/g++.law/operators27.C index f8ca9d1..6a07176 100644 --- a/gcc/testsuite/g++.old-deja/g++.law/operators27.C +++ b/gcc/testsuite/g++.old-deja/g++.law/operators27.C @@ -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 diff --git a/gcc/testsuite/g++.old-deja/g++.mike/dyncast1.C b/gcc/testsuite/g++.old-deja/g++.mike/dyncast1.C index 0b6fd38..fbcc489 100644 --- a/gcc/testsuite/g++.old-deja/g++.mike/dyncast1.C +++ b/gcc/testsuite/g++.old-deja/g++.mike/dyncast1.C @@ -15,7 +15,7 @@ main() { B b; try { (void)dynamic_cast<D&>(b); - } catch (bad_cast) { + } catch (std::bad_cast) { return 0; } return 1; diff --git a/gcc/testsuite/g++.old-deja/g++.mike/dyncast2.C b/gcc/testsuite/g++.old-deja/g++.mike/dyncast2.C index dbad641..ba7a39e 100644 --- a/gcc/testsuite/g++.old-deja/g++.mike/dyncast2.C +++ b/gcc/testsuite/g++.old-deja/g++.mike/dyncast2.C @@ -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; diff --git a/gcc/testsuite/g++.old-deja/g++.mike/dyncast7.C b/gcc/testsuite/g++.old-deja/g++.mike/dyncast7.C index 1373d0f..b1a55a4 100644 --- a/gcc/testsuite/g++.old-deja/g++.mike/dyncast7.C +++ b/gcc/testsuite/g++.old-deja/g++.mike/dyncast7.C @@ -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; } diff --git a/gcc/testsuite/g++.old-deja/g++.mike/eh23.C b/gcc/testsuite/g++.old-deja/g++.mike/eh23.C index 17a9669..27fc53d 100644 --- a/gcc/testsuite/g++.old-deja/g++.mike/eh23.C +++ b/gcc/testsuite/g++.old-deja/g++.mike/eh23.C @@ -36,7 +36,7 @@ void my_terminate() { } main() { - set_terminate (my_terminate); + std::set_terminate (my_terminate); try { bar(); } catch (...) { diff --git a/gcc/testsuite/g++.old-deja/g++.mike/eh25.C b/gcc/testsuite/g++.old-deja/g++.mike/eh25.C index 66045b1..52754b5 100644 --- a/gcc/testsuite/g++.old-deja/g++.mike/eh25.C +++ b/gcc/testsuite/g++.old-deja/g++.mike/eh25.C @@ -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 } }; diff --git a/gcc/testsuite/g++.old-deja/g++.mike/eh33.C b/gcc/testsuite/g++.old-deja/g++.mike/eh33.C index ce57067..49214f1 100644 --- a/gcc/testsuite/g++.old-deja/g++.mike/eh33.C +++ b/gcc/testsuite/g++.old-deja/g++.mike/eh33.C @@ -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) { diff --git a/gcc/testsuite/g++.old-deja/g++.mike/eh34.C b/gcc/testsuite/g++.old-deja/g++.mike/eh34.C index 986db27..0f27801 100644 --- a/gcc/testsuite/g++.old-deja/g++.mike/eh34.C +++ b/gcc/testsuite/g++.old-deja/g++.mike/eh34.C @@ -10,7 +10,7 @@ void my_unexpected() { foo() throw () { throw "Hi"; } main() { - set_unexpected (my_unexpected); + std::set_unexpected (my_unexpected); foo(); return 1; } diff --git a/gcc/testsuite/g++.old-deja/g++.mike/eh47.C b/gcc/testsuite/g++.old-deja/g++.mike/eh47.C index 708de10..043a617 100644 --- a/gcc/testsuite/g++.old-deja/g++.mike/eh47.C +++ b/gcc/testsuite/g++.old-deja/g++.mike/eh47.C @@ -14,7 +14,7 @@ main() { } catch (...) { } try { - set_terminate (myterm); + std::set_terminate (myterm); throw; } catch (...) { return 1; diff --git a/gcc/testsuite/g++.old-deja/g++.mike/eh48.C b/gcc/testsuite/g++.old-deja/g++.mike/eh48.C index 5cefacd..351fc4f 100644 --- a/gcc/testsuite/g++.old-deja/g++.mike/eh48.C +++ b/gcc/testsuite/g++.old-deja/g++.mike/eh48.C @@ -2,7 +2,7 @@ // excess errors test - XFAIL a29k-*-* sparc64-*-elf sh-*-* arm-*-pe**-* #include <exception> - +using std::uncaught_exception; class A { public: ~A() { diff --git a/gcc/testsuite/g++.old-deja/g++.mike/eh50.C b/gcc/testsuite/g++.old-deja/g++.mike/eh50.C index 1ae2d9c..0747e10 100644 --- a/gcc/testsuite/g++.old-deja/g++.mike/eh50.C +++ b/gcc/testsuite/g++.old-deja/g++.mike/eh50.C @@ -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) { diff --git a/gcc/testsuite/g++.old-deja/g++.mike/eh51.C b/gcc/testsuite/g++.old-deja/g++.mike/eh51.C index 56943d4..ac7f620 100644 --- a/gcc/testsuite/g++.old-deja/g++.mike/eh51.C +++ b/gcc/testsuite/g++.old-deja/g++.mike/eh51.C @@ -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) { diff --git a/gcc/testsuite/g++.old-deja/g++.mike/eh55.C b/gcc/testsuite/g++.old-deja/g++.mike/eh55.C index 7e83aaf..e64bcf8 100644 --- a/gcc/testsuite/g++.old-deja/g++.mike/eh55.C +++ b/gcc/testsuite/g++.old-deja/g++.mike/eh55.C @@ -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; } diff --git a/gcc/testsuite/g++.old-deja/g++.mike/ns11.C b/gcc/testsuite/g++.old-deja/g++.mike/ns11.C index f0243ca..77d3110 100644 --- a/gcc/testsuite/g++.old-deja/g++.mike/ns11.C +++ b/gcc/testsuite/g++.old-deja/g++.mike/ns11.C @@ -1,4 +1,3 @@ -// excess errors test - XFAIL *-*-* class Foo { }; diff --git a/gcc/testsuite/g++.old-deja/g++.mike/ns13.C b/gcc/testsuite/g++.old-deja/g++.mike/ns13.C index d0eb3cd..5482a43 100644 --- a/gcc/testsuite/g++.old-deja/g++.mike/ns13.C +++ b/gcc/testsuite/g++.old-deja/g++.mike/ns13.C @@ -1,5 +1,4 @@ // Build don't link: -// excess errors test - XFAIL *-*-* namespace N { struct C { diff --git a/gcc/testsuite/g++.old-deja/g++.mike/ns14.C b/gcc/testsuite/g++.old-deja/g++.mike/ns14.C index 62ac456..3c3ad3f 100644 --- a/gcc/testsuite/g++.old-deja/g++.mike/ns14.C +++ b/gcc/testsuite/g++.old-deja/g++.mike/ns14.C @@ -1,5 +1,4 @@ // Build don't link: -// excess errors test - XFAIL *-*-* namespace Jazz { int horn( int h ) { return 1; } diff --git a/gcc/testsuite/g++.old-deja/g++.mike/ns9.C b/gcc/testsuite/g++.old-deja/g++.mike/ns9.C index b88ae27..65798a7 100644 --- a/gcc/testsuite/g++.old-deja/g++.mike/ns9.C +++ b/gcc/testsuite/g++.old-deja/g++.mike/ns9.C @@ -1,4 +1,3 @@ -// excess errors test - XFAIL *-*-* namespace Foo { bar() { return 0; diff --git a/gcc/testsuite/g++.old-deja/g++.ns/alias1.C b/gcc/testsuite/g++.old-deja/g++.ns/alias1.C new file mode 100644 index 0000000..797e2b2 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.ns/alias1.C @@ -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); +} diff --git a/gcc/testsuite/g++.old-deja/g++.ns/koenig1.C b/gcc/testsuite/g++.old-deja/g++.ns/koenig1.C new file mode 100644 index 0000000..bd721fe --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.ns/koenig1.C @@ -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 ; +} diff --git a/gcc/testsuite/g++.old-deja/g++.ns/lookup1.C b/gcc/testsuite/g++.old-deja/g++.ns/lookup1.C new file mode 100644 index 0000000..6b6f0cc --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.ns/lookup1.C @@ -0,0 +1,3 @@ +// Build don't link: +typedef int __quad_t; +typedef __quad_t __qaddr_t; diff --git a/gcc/testsuite/g++.old-deja/g++.ns/lookup2.C b/gcc/testsuite/g++.old-deja/g++.ns/lookup2.C new file mode 100644 index 0000000..0143290 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.ns/lookup2.C @@ -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>; diff --git a/gcc/testsuite/g++.old-deja/g++.ns/ns1.C b/gcc/testsuite/g++.old-deja/g++.ns/ns1.C new file mode 100644 index 0000000..7c4fd92 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.ns/ns1.C @@ -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); +} diff --git a/gcc/testsuite/g++.old-deja/g++.ns/ns10.C b/gcc/testsuite/g++.old-deja/g++.ns/ns10.C new file mode 100644 index 0000000..3eb70a8 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.ns/ns10.C @@ -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 + } + } +} diff --git a/gcc/testsuite/g++.old-deja/g++.ns/ns11.C b/gcc/testsuite/g++.old-deja/g++.ns/ns11.C new file mode 100644 index 0000000..ffc5acb --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.ns/ns11.C @@ -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 + diff --git a/gcc/testsuite/g++.old-deja/g++.ns/ns12.C b/gcc/testsuite/g++.old-deja/g++.ns/ns12.C new file mode 100644 index 0000000..33d50b1 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.ns/ns12.C @@ -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(); +} diff --git a/gcc/testsuite/g++.old-deja/g++.ns/ns2.C b/gcc/testsuite/g++.old-deja/g++.ns/ns2.C new file mode 100644 index 0000000..dcef203 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.ns/ns2.C @@ -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; +} diff --git a/gcc/testsuite/g++.old-deja/g++.ns/ns3.C b/gcc/testsuite/g++.old-deja/g++.ns/ns3.C new file mode 100644 index 0000000..a1c8f53 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.ns/ns3.C @@ -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); +} diff --git a/gcc/testsuite/g++.old-deja/g++.ns/ns4.C b/gcc/testsuite/g++.old-deja/g++.ns/ns4.C new file mode 100644 index 0000000..f720da3 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.ns/ns4.C @@ -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; +} diff --git a/gcc/testsuite/g++.old-deja/g++.ns/ns5.C b/gcc/testsuite/g++.old-deja/g++.ns/ns5.C new file mode 100644 index 0000000..f35b247 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.ns/ns5.C @@ -0,0 +1,6 @@ +// Build don't link: +namespace X{ + class Y{}; +} + +X::Y z; diff --git a/gcc/testsuite/g++.old-deja/g++.ns/ns6.C b/gcc/testsuite/g++.old-deja/g++.ns/ns6.C new file mode 100644 index 0000000..0617b79 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.ns/ns6.C @@ -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; +} diff --git a/gcc/testsuite/g++.old-deja/g++.ns/ns7.C b/gcc/testsuite/g++.old-deja/g++.ns/ns7.C new file mode 100644 index 0000000..9afc97c --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.ns/ns7.C @@ -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) +{} diff --git a/gcc/testsuite/g++.old-deja/g++.ns/ns8.C b/gcc/testsuite/g++.old-deja/g++.ns/ns8.C new file mode 100644 index 0000000..4d1ab40 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.ns/ns8.C @@ -0,0 +1,11 @@ +// Build don't link: +namespace B{ + void f(); +} + +using namespace B; + +void g() +{ + ::f(); +} diff --git a/gcc/testsuite/g++.old-deja/g++.ns/ns9.C b/gcc/testsuite/g++.old-deja/g++.ns/ns9.C new file mode 100644 index 0000000..a8803b8 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.ns/ns9.C @@ -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 + } + } +} diff --git a/gcc/testsuite/g++.old-deja/g++.ns/overload1.C b/gcc/testsuite/g++.old-deja/g++.ns/overload1.C new file mode 100644 index 0000000..6f6f3d4 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.ns/overload1.C @@ -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; +} diff --git a/gcc/testsuite/g++.old-deja/g++.ns/overload2.C b/gcc/testsuite/g++.old-deja/g++.ns/overload2.C new file mode 100644 index 0000000..500d780 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.ns/overload2.C @@ -0,0 +1,12 @@ +namespace A{ + void f(); // ERROR - .* +} + +using namespace A; + +void f(); // ERROR - .* + +void g() +{ + f(); // ERROR - ambiguous, ::f or A::f ? +} diff --git a/gcc/testsuite/g++.old-deja/g++.ns/overload3.C b/gcc/testsuite/g++.old-deja/g++.ns/overload3.C new file mode 100644 index 0000000..945f948 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.ns/overload3.C @@ -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 +} diff --git a/gcc/testsuite/g++.old-deja/g++.ns/overload4.C b/gcc/testsuite/g++.old-deja/g++.ns/overload4.C new file mode 100644 index 0000000..24d0ced --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.ns/overload4.C @@ -0,0 +1,8 @@ +// Build don't link: +namespace A{ + void f(); // ERROR - .* +} + +using A::f; +void f(); // ERROR - duplicate declaration + diff --git a/gcc/testsuite/g++.old-deja/g++.ns/overload5.C b/gcc/testsuite/g++.old-deja/g++.ns/overload5.C new file mode 100644 index 0000000..210f3b0 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.ns/overload5.C @@ -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); +} diff --git a/gcc/testsuite/g++.old-deja/g++.ns/template1.C b/gcc/testsuite/g++.old-deja/g++.ns/template1.C new file mode 100644 index 0000000..593df9e --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.ns/template1.C @@ -0,0 +1,9 @@ +// Build don't link: +namespace foo { + + template <class T> + class x {}; + +} + +foo::x<int> y; diff --git a/gcc/testsuite/g++.old-deja/g++.ns/template2.C b/gcc/testsuite/g++.old-deja/g++.ns/template2.C new file mode 100644 index 0000000..bb7c1dc --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.ns/template2.C @@ -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; diff --git a/gcc/testsuite/g++.old-deja/g++.ns/using1.C b/gcc/testsuite/g++.old-deja/g++.ns/using1.C new file mode 100644 index 0000000..489faac --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.ns/using1.C @@ -0,0 +1,3 @@ +// Build don't link: +using namespace bb; // ERROR - .* + diff --git a/gcc/testsuite/g++.old-deja/g++.ns/using2.C b/gcc/testsuite/g++.old-deja/g++.ns/using2.C new file mode 100644 index 0000000..879e0c5 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.ns/using2.C @@ -0,0 +1,5 @@ +// Build don't link: +void f(); +namespace A{ + using ::f; +} diff --git a/gcc/testsuite/g++.old-deja/g++.other/temporary1.C b/gcc/testsuite/g++.old-deja/g++.other/temporary1.C new file mode 100644 index 0000000..93cd709 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.other/temporary1.C @@ -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; +} diff --git a/gcc/testsuite/g++.old-deja/g++.pt/scope1.C b/gcc/testsuite/g++.old-deja/g++.pt/scope1.C new file mode 100644 index 0000000..cfd9cdf --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/scope1.C @@ -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; } + }; +}; |