diff options
author | upstream source tree <ports@midipix.org> | 2015-03-15 20:14:05 -0400 |
---|---|---|
committer | upstream source tree <ports@midipix.org> | 2015-03-15 20:14:05 -0400 |
commit | 554fd8c5195424bdbcabf5de30fdc183aba391bd (patch) | |
tree | 976dc5ab7fddf506dadce60ae936f43f58787092 /gcc/testsuite/g++.old-deja/g++.oliva | |
download | cbb-gcc-4.6.4-upstream.tar.bz2 cbb-gcc-4.6.4-upstream.tar.xz |
obtained gcc-4.6.4.tar.bz2 from upstream website;upstream
verified gcc-4.6.4.tar.bz2.sig;
imported gcc-4.6.4 source tree from verified upstream tarball.
downloading a git-generated archive based on the 'upstream' tag
should provide you with a source tree that is binary identical
to the one extracted from the above tarball.
if you have obtained the source via the command 'git clone',
however, do note that line-endings of files in your working
directory might differ from line-endings of the respective
files in the upstream repository.
Diffstat (limited to 'gcc/testsuite/g++.old-deja/g++.oliva')
41 files changed, 919 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.old-deja/g++.oliva/ChangeLog b/gcc/testsuite/g++.old-deja/g++.oliva/ChangeLog new file mode 100644 index 000000000..363ea1795 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.oliva/ChangeLog @@ -0,0 +1,147 @@ +2013-04-12 Release Manager + + * GCC 4.6.4 released. + +2012-03-01 Release Manager + + * GCC 4.6.3 released. + +2011-10-26 Release Manager + + * GCC 4.6.2 released. + +2011-06-27 Release Manager + + * GCC 4.6.1 released. + +2011-03-25 Release Manager + + * GCC 4.6.0 released. + +2005-04-03 Alexandre Oliva <aoliva@redhat.com> + + PR c++/19199 + * expr2.C: Fixed. + +2003-06-04 J"orn Rennecke <joern.rennecke@superh.com> + + * template1.C (bar): Remove xfail marker. + +2002-07-06 Alexandre Oliva <aoliva@redhat.com> + + * linkage1.C, linkage1-main.cc: New test. + +2001-02-15 Alexandre Oliva <aoliva@redhat.com> + + * friend1.C: New test. + +2000-05-28 Alexandre Oliva <aoliva@cygnus.com> + + * expr2.C: New test. + +2000-04-19 Alexandre Oliva <oliva@lsd.ic.unicamp.br> + + * stkalign.C: New test. + +1999-12-22 Alexandre Oliva <oliva@lsd.ic.unicamp.br> + + * nameret2.C: New test. + + * nameret1.C: New test. + + * template10.C: New test. + +1999-11-21 Alexandre Oliva <oliva@lsd.ic.unicamp.br> + + * delete2.C, delete3.C, delete4.C, delete5.C: New tests. + +1999-11-19 Alexandre Oliva <oliva@lsd.ic.unicamp.br> + + * template7.C: Crash test passes, bug error is now bogus. + +1999-11-11 Alexandre Oliva <oliva@lsd.ic.unicamp.br> + + * template9.C: New test. + +1999-09-18 Alexandre Oliva <oliva@lsd.ic.unicamp.br> + + * overload1.C: New test. + + * inline1.C: New test. + +1999-08-25 Alexandre Oliva <oliva@dcc.unicamp.br> + + * thunk1.C: New test. + +1999-08-06 Alexandre Oliva <oliva@dcc.unicamp.br> + + * dwarf2.C, dwarf3.C: Added XFAIL for Solaris/x86. Removed + -gdwarf. + * dwarf1.C: Removed -gdwarf. + +1999-08-05 Alexandre Oliva <oliva@dcc.unicamp.br> + + * new1.C, template8.C: Removed XFAIL. + * template3.C: Re-introduced XFAIL. :-( + +1999-08-03 Alexandre Oliva <oliva@dcc.unicamp.br> + + * ext1.C: New test. + + * dwarf1.C, dwarf2.C, dwarf3.C: New tests. + +1999-07-20 Alexandre Oliva <oliva@dcc.unicamp.br> + + * template8.C, typeof1.C: New test. + +1999-07-17 Alexandre Oliva <oliva@dcc.unicamp.br> + + * template6.C, delete1.C, template7.C: New test. + +1999-07-13 Alexandre Oliva <oliva@dcc.unicamp.br> + + * template5.C: New test. + + * template4.C: New test. + + * expr1.C: New test. + + * partspec1.C: New test. + +1999-07-05 Alexandre Oliva <oliva@dcc.unicamp.br> + + * typename1.C, typename2.C: New tests. + + * template3.C: Fixed. + + * ns3.C: New test. + +1999-07-03 Alexandre Oliva <oliva@dcc.unicamp.br> + + * ctor1.C: New test. + + * template3.C: New test. + +1999-07-02 Alexandre Oliva <oliva@dcc.unicamp.br> + + * ns1.C: Typo. + * ns2.C: New test. + + * template2.C: New test. + + * ns1.C: New test. + +1999-07-01 Alexandre Oliva <oliva@dcc.unicamp.br> + + * new1.C: New test. + + * partord1.C: New test. + + * template1.C: New test. + + +Copyright (C) 1999, 2000, 2001, 2002, 2003, 2005 Free Software Foundation, Inc. + +Copying and distribution of this file, with or without modification, +are permitted in any medium without royalty provided the copyright +notice and this notice are preserved. diff --git a/gcc/testsuite/g++.old-deja/g++.oliva/ctor1.C b/gcc/testsuite/g++.old-deja/g++.oliva/ctor1.C new file mode 100644 index 000000000..d8ad0c74d --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.oliva/ctor1.C @@ -0,0 +1,19 @@ +// { dg-do assemble } + +// Copyright (C) 1999 Free Software Foundation + +// by Alexandre Oliva <oliva@dcc.unicamp.br> +// based on bug report by Harri Porten <porten@tu-harburg.de> + +struct A { + A() : x; // { dg-error "" } missing body +}; + +struct B { + void m() {} +}; + +struct C { + // The error message below says it is within A::B::m()! + void n() {} +}; diff --git a/gcc/testsuite/g++.old-deja/g++.oliva/delete1.C b/gcc/testsuite/g++.old-deja/g++.oliva/delete1.C new file mode 100644 index 000000000..368a87a2a --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.oliva/delete1.C @@ -0,0 +1,31 @@ +// { dg-do assemble } + +// Copyright (C) 1999, 2001 Free Software Foundation + +// by Alexandre Oliva <oliva@dcc.unicamp.br> +// simplified from bug report by K. Haley <khaley@bigfoot.com> +// based on analysis by Martin v. Loewis + +// [class.dtor]/11: delete must be implicitly checked for +// accessibility only in the definition of virtual destructors, +// implicitly defined or not. + +struct foo { + foo() {} +private: + void operator delete(void *) {} // { dg-error "" } private +} foo_; + +struct bar : foo { + ~bar() { + delete this; // { dg-error "" } delete is private + // An implicit invocation of delete is emitted in destructors, but + // it should only be checked in virtual destructors + } // { dg-bogus "" } not virtual +} bar_; + +struct baz : foo { + virtual ~baz() {} // { dg-error "" } delete is private in vdtor +} baz_; + +struct bad : baz {} bad_; // { dg-message "" } delete is private in vdtor diff --git a/gcc/testsuite/g++.old-deja/g++.oliva/delete2.C b/gcc/testsuite/g++.old-deja/g++.oliva/delete2.C new file mode 100644 index 000000000..4a5cda45e --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.oliva/delete2.C @@ -0,0 +1,26 @@ +// { dg-do run } +// Copyright (C) 1999 Free Software Foundation + +// by Alexandre Oliva <oliva@lsd.ic.unicamp.br> +// distilled from bug report by Barry M. Caceres <barryc@itravelpartners.com> + +// Test whether dtors of vbases are called on delete[]. + +extern "C" void abort(); +extern "C" void exit(int); + +struct Foo { + ~Foo() { + exit(0); + } +}; + +struct Bar : virtual Foo { +}; + +int main() { + delete [] new Bar[1]; + abort(); +} + + diff --git a/gcc/testsuite/g++.old-deja/g++.oliva/delete3.C b/gcc/testsuite/g++.old-deja/g++.oliva/delete3.C new file mode 100644 index 000000000..39b6fbe9e --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.oliva/delete3.C @@ -0,0 +1,38 @@ +// { dg-do run } +// Copyright (C) 1999 Free Software Foundation + +// by Alexandre Oliva <oliva@lsd.ic.unicamp.br> + +// Test whether dtors of vbases are called on throw within new[]. +// Variant of delete2.C. + +extern "C" void abort(); +extern "C" void exit(int); + +struct Foo { + static bool first; + + Foo() { + if (first) + first = false; + else + throw first; + } + + ~Foo() { + exit(0); + } +}; + +bool Foo::first = true; + +struct Bar : virtual Foo { +}; + +int main() { + try { + delete [] new Bar[2]; + } catch (...) { + } + abort(); +} diff --git a/gcc/testsuite/g++.old-deja/g++.oliva/delete4.C b/gcc/testsuite/g++.old-deja/g++.oliva/delete4.C new file mode 100644 index 000000000..83084a173 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.oliva/delete4.C @@ -0,0 +1,30 @@ +// { dg-do run } +// Copyright (C) 1999 Free Software Foundation + +// by Alexandre Oliva <oliva@lsd.ic.unicamp.br> + +// Test whether dtors of vbases are called from dtor of aggregate of array. +// Variant of delete2.C and delete3.C. + +extern "C" void abort(); +extern "C" void exit(int); + +struct Foo { + ~Foo() { + exit(0); + } +}; + +struct Bar : virtual Foo { +}; + +struct Baz { + Bar i[1]; +}; + +int main() { + Baz(); + abort(); +} + + diff --git a/gcc/testsuite/g++.old-deja/g++.oliva/delete5.C b/gcc/testsuite/g++.old-deja/g++.oliva/delete5.C new file mode 100644 index 000000000..daf2b53a7 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.oliva/delete5.C @@ -0,0 +1,30 @@ +// { dg-do run } +// Copyright (C) 1999 Free Software Foundation + +// by Alexandre Oliva <oliva@lsd.ic.unicamp.br> + +// Test whether dtors of vbases are called from dtor of auto array. +// Variant of delete2.C, delete3.C and delete4.C. + +extern "C" void abort(); +extern "C" void exit(int); + +struct Foo { + ~Foo() { + exit(0); + } +}; + +struct Bar : virtual Foo { +}; + +void foo() { + Bar i[1]; +} + +int main() { + foo(); + abort(); +} + + diff --git a/gcc/testsuite/g++.old-deja/g++.oliva/dwarf1.C b/gcc/testsuite/g++.old-deja/g++.oliva/dwarf1.C new file mode 100644 index 000000000..3b932f712 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.oliva/dwarf1.C @@ -0,0 +1,15 @@ +// { dg-do assemble } + +// Copyright (C) 1999 Free Software Foundation + +// by Alexandre Oliva <oliva@dcc.unicamp.br> +// based on bug report by Chris McKay <chris.mckay@solipsys.com> + +// Used to fail with dwarf debugging. + +template <class T = void> +struct foo { + static const int ELEMENTS = 1; + int bar[ELEMENTS]; +}; +foo<> bar; diff --git a/gcc/testsuite/g++.old-deja/g++.oliva/dwarf2.C b/gcc/testsuite/g++.old-deja/g++.oliva/dwarf2.C new file mode 100644 index 000000000..c50b1b7d6 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.oliva/dwarf2.C @@ -0,0 +1,10 @@ +// { dg-do assemble } + +// Copyright (C) 1999 Free Software Foundation + +// by Alexandre Oliva <oliva@dcc.unicamp.br> + +// Fails with dwarf debugging. + +typedef __java_boolean jboolean; +void foo() {} diff --git a/gcc/testsuite/g++.old-deja/g++.oliva/dwarf3.C b/gcc/testsuite/g++.old-deja/g++.oliva/dwarf3.C new file mode 100644 index 000000000..bbe5b0c9c --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.oliva/dwarf3.C @@ -0,0 +1,25 @@ +// { dg-do assemble } + +// Copyright (C) 1999 Free Software Foundation + +// by Alexandre Oliva <oliva@dcc.unicamp.br> +// based on bug report by Andreas Stolcke <stolcke@speech.sri.com> + +// Fails with dwarf debugging. + +template <class T = void> struct foo { + int data[1]; +}; + +template <class T = void> struct bar { + bar(foo<> *); +}; + +template <class T> bar<T>::bar(foo<> *x) { + *x; +} + +void baz() { + foo<> *baz; + bar<> baar(baz); +} diff --git a/gcc/testsuite/g++.old-deja/g++.oliva/expr1.C b/gcc/testsuite/g++.old-deja/g++.oliva/expr1.C new file mode 100644 index 000000000..2d6e8f96b --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.oliva/expr1.C @@ -0,0 +1,12 @@ +// { dg-do assemble } + +// Copyright (C) 1999 Free Software Foundation + +// by Alexandre Oliva <oliva@dcc.unicamp.br> +// simplified from bug report by Tudor Hulubei <tudor.hulubei@ecora.com> + +// gcc 2.95 reports: +// invalid operands `foo' and `int' to binary `operator !=' + +class foo {} bar; +int i = void(bar) ? 1 : 0; // { dg-bogus "" "" { xfail *-*-* } } - operator!= - diff --git a/gcc/testsuite/g++.old-deja/g++.oliva/expr2.C b/gcc/testsuite/g++.old-deja/g++.oliva/expr2.C new file mode 100644 index 000000000..1e63c645b --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.oliva/expr2.C @@ -0,0 +1,16 @@ +// { dg-do run } + +// Copyright (C) 2000 Free Software Foundation + +// by Alexandre Oliva <aoliva@cygnus.com> + +int i, j; + +const int &f(const int& I, const int& J) { + // this must not be optimized to I because it's an lvalue + return (I != J) ? I : J; +} + +int main () { + return (&f(i, j) != &j); +} diff --git a/gcc/testsuite/g++.old-deja/g++.oliva/ext1.C b/gcc/testsuite/g++.old-deja/g++.oliva/ext1.C new file mode 100644 index 000000000..1bc37357a --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.oliva/ext1.C @@ -0,0 +1,19 @@ +// { dg-do run } +// { dg-options "" } +// Copyright (C) 1999 Free Software Foundation + +// by Alexandre Oliva <oliva@dcc.unicamp.br> +// simplified from bug report by Michael Rosenbruch <Rosenbruch@bfw-online.de> + + +extern "C" void abort(); + +int main () { + char x[1]; + char *y = x ? /* implicit x */ : 0; + /* For some reason, the array x is copied twice, and y points to the + second copy (the first is never used). If x is explicit, no copy + is created, and the program succeeds. */ + if (x != y) + abort(); +} diff --git a/gcc/testsuite/g++.old-deja/g++.oliva/friend1.C b/gcc/testsuite/g++.old-deja/g++.oliva/friend1.C new file mode 100644 index 000000000..636260780 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.oliva/friend1.C @@ -0,0 +1,12 @@ +// { dg-do assemble } + +// Copyright (C) 2001 Free Software Foundation + +// by Alexandre Oliva <aoliva@redhat.com> + +// We shouldn't warn about bar referring to a non-template in this case. + +template <typename T> +class foo { + friend int bar(int); +}; diff --git a/gcc/testsuite/g++.old-deja/g++.oliva/inline1.C b/gcc/testsuite/g++.old-deja/g++.oliva/inline1.C new file mode 100644 index 000000000..f182b8344 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.oliva/inline1.C @@ -0,0 +1,30 @@ +// { dg-do assemble } + +// Copyright (C) 1999 Free Software Foundation + +// by Alexandre Oliva <oliva@lsd.ic.unicamp.br> +// Derived from GNU lilypond. + + +struct foo { + foo(); + foo(const foo&); + ~foo(); +}; + +struct bar { + foo foo_member; + bar(); + bar(const bar&); + // ~bar(); +}; + +struct baz { + void error (bar s); +}; + +void fail() __attribute__((noreturn)); + +void baz::error (bar s) { + fail(); +} diff --git a/gcc/testsuite/g++.old-deja/g++.oliva/linkage1-main.cc b/gcc/testsuite/g++.old-deja/g++.oliva/linkage1-main.cc new file mode 100644 index 000000000..80d27c36c --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.oliva/linkage1-main.cc @@ -0,0 +1,13 @@ +// Copyright 2002 Free Software Foundation + +// Derived by Alexandre Oliva <aoliva@redhat.com> from code posted by +// Mark Mitchell <mark@codesourcery.com> + +typedef struct { + void f(); +} S; + +int main() { + S s; + s.f(); +} diff --git a/gcc/testsuite/g++.old-deja/g++.oliva/linkage1.C b/gcc/testsuite/g++.old-deja/g++.oliva/linkage1.C new file mode 100644 index 000000000..23295ea36 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.oliva/linkage1.C @@ -0,0 +1,20 @@ +// { dg-do link } +// { dg-additional-sources " linkage1-main.cc" } + +// Copyright 2002 Free Software Foundation + +// Derived by Alexandre Oliva <aoliva@redhat.com> from code posted by +// Mark Mitchell <mark@codesourcery.com> + +// Verify that a member of a class is given global linkage when it's a +// member of a function whose name is taken from a typedef, by +// checking that another translation unit can call it. We don't do +// the right things on functions, but we do on data members. + +// { dg-bogus "" "" { xfail *-*-* } 0 } + +typedef struct { + void f(); +} S; + +void S::f() {} diff --git a/gcc/testsuite/g++.old-deja/g++.oliva/nameret1.C b/gcc/testsuite/g++.old-deja/g++.oliva/nameret1.C new file mode 100644 index 000000000..b32deedd4 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.oliva/nameret1.C @@ -0,0 +1,14 @@ +// { dg-do assemble } +// { dg-options "-Wno-deprecated" } +// Copyright (C) 1999, 2000, 2002 Free Software Foundation + +// by Alexandre Oliva <oliva@lsd.ic.unicamp.br> + +// distilled from libg++'s Rational.cc + + +inline int bar () return r {} // { dg-error "" } + +int foo () { + return bar (); +} diff --git a/gcc/testsuite/g++.old-deja/g++.oliva/nameret2.C b/gcc/testsuite/g++.old-deja/g++.oliva/nameret2.C new file mode 100644 index 000000000..e0dfb7e12 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.oliva/nameret2.C @@ -0,0 +1,15 @@ +// { dg-do assemble } +// { dg-options "-O1 -Wno-deprecated" } +// Copyright (C) 1999, 2000, 2002 Free Software Foundation + +// by Alexandre Oliva <oliva@lsd.ic.unicamp.br> + +// distilled from libg++'s Integer.cc + + +inline int bar () return r {} // { dg-error "" } + +int& foo (int& x) { + bar (); + return x; +} diff --git a/gcc/testsuite/g++.old-deja/g++.oliva/new1.C b/gcc/testsuite/g++.old-deja/g++.oliva/new1.C new file mode 100644 index 000000000..86d25f8e6 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.oliva/new1.C @@ -0,0 +1,20 @@ +// { dg-do run } +// Copyright (C) 1999 Free Software Foundation + +// by Alexandre Oliva <oliva@dcc.unicamp.br> + +// based on comp.std.c++ post by Alexander Schiemann <aschiem@math.uni-sb.de> + +// execution test + +#include <new> +#include <stdlib.h> + +struct A { + A() { throw 0; } + void* operator new(size_t size, double = 0.0) { return ::operator new(size);} + void operator delete(void* p, double) { exit(0); } + void operator delete(void* p) { abort(); } +}; + +int main() { try { new A; } catch(...) {} } diff --git a/gcc/testsuite/g++.old-deja/g++.oliva/ns1.C b/gcc/testsuite/g++.old-deja/g++.oliva/ns1.C new file mode 100644 index 000000000..cda0f0e2e --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.oliva/ns1.C @@ -0,0 +1,13 @@ +// { dg-do assemble } + +// Copyright (C) 1999, 2000 Free Software Foundation + +// by Alexandre Oliva <oliva@dcc.unicamp.br> +// based on bug report by Dima Volodin <dvv@dvv.ru> + +void foo(); +namespace bar { + class baz { + friend void ::foo(); // { dg-bogus "" } parse error + }; +} diff --git a/gcc/testsuite/g++.old-deja/g++.oliva/ns2.C b/gcc/testsuite/g++.old-deja/g++.oliva/ns2.C new file mode 100644 index 000000000..0541a3f71 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.oliva/ns2.C @@ -0,0 +1,15 @@ +// { dg-do assemble } + +// Copyright (C) 1999 Free Software Foundation + +// by Alexandre Oliva <oliva@dcc.unicamp.br> +// based on bug report by Dima Volodin <dvv@dvv.ru> +// variation of ns1.C + +void foo(); +namespace bar { + using ::foo; + class baz { + friend void foo(); // { dg-bogus "" "" { xfail *-*-* } } - conflict - + }; +} diff --git a/gcc/testsuite/g++.old-deja/g++.oliva/ns3.C b/gcc/testsuite/g++.old-deja/g++.oliva/ns3.C new file mode 100644 index 000000000..4ddbb3289 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.oliva/ns3.C @@ -0,0 +1,13 @@ +// { dg-do assemble } + +// Copyright (C) 1999 Free Software Foundation + +// by Alexandre Oliva <oliva@dcc.unicamp.br> +// based on bug report by Ovidiu Toader <ovi@physics.utoronto.ca> + + +namespace N { + template <typename T> class A { + template <typename T_> friend class A; + }; +} diff --git a/gcc/testsuite/g++.old-deja/g++.oliva/overload1.C b/gcc/testsuite/g++.old-deja/g++.oliva/overload1.C new file mode 100644 index 000000000..91b3b02a4 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.oliva/overload1.C @@ -0,0 +1,24 @@ +// { dg-do assemble } + +// Copyright (C) 1999 Free Software Foundation + +// by Alexandre Oliva <oliva@lsd.ic.unicamp.br> +// Based on bug report by JDonner <jdonner@schedsys.com> + +struct foo { + static int bar(); // { dg-error "candidate" } + void bar(int); // { dg-error "foo::bar" } +}; + +/* gcc emits a hard error without -pedantic, and a warning with + -pedantic, even in bad1. */ +int (*ok1)() = foo::bar; +void (foo::*bad1)(int) = foo::bar; // { dg-error "assuming pointer" } +// { dg-message "note" "note" { target *-*-* } 16 } + +int (*ok2)() = &foo::bar; // ok +void (*bad2)(int) = foo::bar; // { dg-error "no matches" } + +void (foo::*ok3)(int) = &foo::bar; // ok +int (foo::*bad3)() = foo::bar; // { dg-error "no matches" } + diff --git a/gcc/testsuite/g++.old-deja/g++.oliva/partord1.C b/gcc/testsuite/g++.old-deja/g++.oliva/partord1.C new file mode 100644 index 000000000..34fe92e64 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.oliva/partord1.C @@ -0,0 +1,28 @@ +// { dg-do assemble } + +// Copyright (C) 1999 Free Software Foundation + +// by Alexandre Oliva <oliva@dcc.unicamp.br> + +template <typename T> void foo(T); +template <typename T> void foo(T*); + +template <typename T> class bar { + private: + int i; // { dg-error "" } this variable + friend void foo<T>(T); +}; + +template <typename T> void foo(T) { + bar<T>().i; // ok, I'm a friend +} +template <typename T> void foo(T*) { + bar<T*>().i; // { dg-error "" } not a friend +} + +int main() { + int j = 0; + foo(j); // calls foo<int>(int), ok + foo(&j); // calls foo<int>(int*) + foo<int*>(&j); // calls foo<int*>(int*), ok +} diff --git a/gcc/testsuite/g++.old-deja/g++.oliva/partspec1.C b/gcc/testsuite/g++.old-deja/g++.oliva/partspec1.C new file mode 100644 index 000000000..887924781 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.oliva/partspec1.C @@ -0,0 +1,20 @@ +// { dg-do assemble } + +// Copyright (C) 1999 Free Software Foundation + +// by Alexandre Oliva <oliva@dcc.unicamp.br> +// simplified from bug report by Andrey Slepuhin <pooh@msu.ru> + +template <typename A, int* P> struct X; + +int a; + +template <typename A> +struct X<A,&a> {}; + +int b; + +template <typename A> +struct X<A,&b> {}; + +X<int,&a> x; diff --git a/gcc/testsuite/g++.old-deja/g++.oliva/stkalign.C b/gcc/testsuite/g++.old-deja/g++.oliva/stkalign.C new file mode 100644 index 000000000..2b24f489e --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.oliva/stkalign.C @@ -0,0 +1,18 @@ +// { dg-do assemble } + +// Copyright (C) 2000 Free Software Foundation + +// by Alexandre Oliva <aoliva@cygnus.com> +// distilled from libg++'s Fix.cc + + +struct Integer { + ~Integer () {} +}; + +void foo (const Integer& y); +Integer bar (const Integer& x); + +void show (const Integer& x) { + foo (bar (x)); +} diff --git a/gcc/testsuite/g++.old-deja/g++.oliva/template1.C b/gcc/testsuite/g++.old-deja/g++.oliva/template1.C new file mode 100644 index 000000000..ce3949618 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.oliva/template1.C @@ -0,0 +1,15 @@ +// { dg-do assemble } + +// Copyright (C) 1999, 2003 Free Software Foundation + +// by Alexandre Oliva <oliva@dcc.unicamp.br> +// based on bug report by Stefan Wetzel <Stefan_Wetzel@Physik.TU-Muenchen.DE> + + +template<int P = 0> struct foo { + static void bar(double (*)[dim]) {} // { dg-error "'dim' was not declared" } +}; + +void bar() { + foo<>::bar(0); +} diff --git a/gcc/testsuite/g++.old-deja/g++.oliva/template10.C b/gcc/testsuite/g++.old-deja/g++.oliva/template10.C new file mode 100644 index 000000000..5c1204bdd --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.oliva/template10.C @@ -0,0 +1,22 @@ +// { dg-do assemble } + +// Copyright (C) 1999 Free Software Foundation + +// by Alexandre Oliva <oliva@lsd.ic.unicamp.br> +// bug report by Martin Sebor <sebor@roguewave.com> +// based on C++ Standard example in [temp.expl.spec]/5 + +/* Members of explicitly specialized template classes shall not be + defined with template-specialization syntax. The example in the + Standard contains a definition of a member function of the + explicitly specialized class template, but the paragraph refers to + members in general, not only member functions. */ + +template<class T> struct A {}; + +template<> struct A<int> { + static bool a, b; +}; + +bool A<int>::a = true; // ok +template<> bool A<int>::b = false; // { dg-error "template header" } diff --git a/gcc/testsuite/g++.old-deja/g++.oliva/template2.C b/gcc/testsuite/g++.old-deja/g++.oliva/template2.C new file mode 100644 index 000000000..359e9b465 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.oliva/template2.C @@ -0,0 +1,14 @@ +// { dg-do assemble } + +// Copyright (C) 1999 Free Software Foundation + +// by Alexandre Oliva <oliva@dcc.unicamp.br> +// based on bug report by Gabriel Dos_Reis <Gabriel.Dos_Reis@sophia.inria.fr> + +template <template <typename> class C, typename T> class foo { + typedef typename C<T>::bar bar; + foo(bar); +}; + +template <template <typename> class C, typename T> foo<C,T>::foo(bar) +{} // { dg-bogus "" } C<T> not a class diff --git a/gcc/testsuite/g++.old-deja/g++.oliva/template3.C b/gcc/testsuite/g++.old-deja/g++.oliva/template3.C new file mode 100644 index 000000000..056f77c61 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.oliva/template3.C @@ -0,0 +1,9 @@ +// { dg-do assemble } + +// Copyright (C) 1999 Free Software Foundation + +// by Alexandre Oliva <oliva@dcc.unicamp.br> +// based on bug report by Ulf Larsson <ulf.larsson@mbow337.swipnet.se> + +template <class T> class C {}; +class foo {} bar = bar.C(); // { dg-error "" } call to template diff --git a/gcc/testsuite/g++.old-deja/g++.oliva/template4.C b/gcc/testsuite/g++.old-deja/g++.oliva/template4.C new file mode 100644 index 000000000..2268fde40 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.oliva/template4.C @@ -0,0 +1,20 @@ +// { dg-do assemble } + +// Copyright (C) 1999 Free Software Foundation + +// by Alexandre Oliva <oliva@dcc.unicamp.br> +// based on bug report by Andrey Slepuhin <pooh@msu.ru> + +template <const int&> struct X {}; + +int a = 1; +X<a> x; // ok, a has external linkage + +const int b = 2; +X<b> y; // { dg-error "" } const b has internal linkage + +extern const int c; +X<c> z; // ok, c has external linkage + +extern const int c = 3; +X<c> z_; // { dg-bogus "" } using c as constant diff --git a/gcc/testsuite/g++.old-deja/g++.oliva/template5.C b/gcc/testsuite/g++.old-deja/g++.oliva/template5.C new file mode 100644 index 000000000..baecea576 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.oliva/template5.C @@ -0,0 +1,12 @@ +// { dg-do assemble } + +// Copyright (C) 1999 Free Software Foundation + +// by Alexandre Oliva <oliva@dcc.unicamp.br> +// simplified from bug report by Andrey Slepuhin <pooh@msu.ru> + +template <typename> class X { + template <typename> class Z; +}; + +X<void> a; diff --git a/gcc/testsuite/g++.old-deja/g++.oliva/template6.C b/gcc/testsuite/g++.old-deja/g++.oliva/template6.C new file mode 100644 index 000000000..270d67695 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.oliva/template6.C @@ -0,0 +1,12 @@ +// { dg-do assemble } + +// Copyright (C) 1999 Free Software Foundation + +// by Alexandre Oliva <oliva@dcc.unicamp.br> +// simplified from bug report by Meenaradchagan Vishnu <mvishnu@fore.com> + +template <typename> struct foo {}; +template <> void foo(); // { dg-error "not a template function" } bad specialization + +struct baz {}; +template <> void baz (); // { dg-error "not a template function" } bad specialization diff --git a/gcc/testsuite/g++.old-deja/g++.oliva/template7.C b/gcc/testsuite/g++.old-deja/g++.oliva/template7.C new file mode 100644 index 000000000..3bcff56ae --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.oliva/template7.C @@ -0,0 +1,14 @@ +// { dg-do assemble } + +// Copyright (C) 1999, 2000 Free Software Foundation + +// by Alexandre Oliva <oliva@lsd.ic.unicamp.br> +// simplified from bug report by Paul Burchard <burchard@pobox.com> + +template<class> struct A {}; +template<template<class> class T> struct B { + B() { + T<B>(); // { dg-bogus "" } conversion from int to non-scalar + } +}; +B<A> foo; diff --git a/gcc/testsuite/g++.old-deja/g++.oliva/template8.C b/gcc/testsuite/g++.old-deja/g++.oliva/template8.C new file mode 100644 index 000000000..86c4d0c69 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.oliva/template8.C @@ -0,0 +1,18 @@ +// { dg-do assemble } + +// Copyright (C) 1999 Free Software Foundation + +// by Alexandre Oliva <oliva@dcc.unicamp.br> +// simplified from bug report by redleaf <e1wwater@dingo.cc.uq.edu.au> + +struct B { + template <class> void bar(); +} b; + +template <class T> void foo() { + b.bar<T>(); // no longer { dg-bogus "" } bar undeclared + b.template bar<T>(); // no longer { dg-bogus "" } ditto + b.B::bar<T>(); // ok +} + +template void foo<void>(); // no longer { dg-bogus "" } diff --git a/gcc/testsuite/g++.old-deja/g++.oliva/template9.C b/gcc/testsuite/g++.old-deja/g++.oliva/template9.C new file mode 100644 index 000000000..02be37a5f --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.oliva/template9.C @@ -0,0 +1,11 @@ +// { dg-do assemble } + +// Copyright (C) 1999 Free Software Foundation + +// by Alexandre Oliva <oliva@lsd.ic.unicamp.br> +// based on bug report by Philippe Bouchard <boucp00@DMI.USherb.CA> + +struct foo { + template <class> + void bar() = 0; // { dg-error "virtual" } +}; diff --git a/gcc/testsuite/g++.old-deja/g++.oliva/thunk1.C b/gcc/testsuite/g++.old-deja/g++.oliva/thunk1.C new file mode 100644 index 000000000..640023ff7 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.oliva/thunk1.C @@ -0,0 +1,36 @@ +// { dg-do run } +// Copyright (C) 1999 Free Software Foundation + +// by Alexandre Oliva <oliva@dcc.unicamp.br> +// based on bug report by Fredrik Öhrström <d92-foh@nada.kth.se> + +#include <cstdlib> + +using namespace std; + +struct vbase { + virtual int get_a() const = 0; +}; + +struct base: virtual vbase { + int a; + base(int aa) : a(aa) {} + int get_a() const { return a; } +}; + +struct mid: base { + mid(int bb) : base(bb) { + // when mid is not in charge of vbase initialization, + // a derived-aware vtable is needed for vbase + if (((vbase*)this)->get_a() != bb) + abort(); + } +}; + +struct derived: virtual mid { + derived(int cc) : mid(cc) {} +}; + +int main () { + derived(1); +} diff --git a/gcc/testsuite/g++.old-deja/g++.oliva/typename1.C b/gcc/testsuite/g++.old-deja/g++.oliva/typename1.C new file mode 100644 index 000000000..83569dd3f --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.oliva/typename1.C @@ -0,0 +1,16 @@ +// { dg-do assemble } + +// Copyright (C) 1999 Free Software Foundation + +// by Alexandre Oliva <oliva@dcc.unicamp.br> +// based on bug report by Nick Rasmussen <nick@jive.org> + +template <class T> struct foo; + +template <class T> struct bar { + typedef int foo; +}; + +template <class T> struct baz { + typedef bar<T>::foo foo; // { dg-error "" } missing typename +}; diff --git a/gcc/testsuite/g++.old-deja/g++.oliva/typename2.C b/gcc/testsuite/g++.old-deja/g++.oliva/typename2.C new file mode 100644 index 000000000..86512c983 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.oliva/typename2.C @@ -0,0 +1,28 @@ +// { dg-do assemble } +// { dg-options "" } + +// Copyright (C) 1999 Free Software Foundation + +// by Alexandre Oliva <oliva@dcc.unicamp.br> +// based on bug report by Nick Rasmussen <nick@jive.org> + +// This is slightly different from typename1.C. This one tests +// whether the implicit typename extension works. gcc 2.95 reports: + +// warning: lookup of `foo' finds `struct foo' +// warning: instead of `baz<T>::foo' from dependent base class +// warning: (use `typename baz::foo' if that's what you meant) + +// But baz<T>::foo is not a base class, and `foo' should have been +// found in baz's scope. + +struct foo; + +template <class T> struct bar { + typedef int foo; +}; + +template <class T> struct baz { + typedef bar<T>::foo foo; // { dg-error "" } implicit typename + void m(foo); +}; diff --git a/gcc/testsuite/g++.old-deja/g++.oliva/typeof1.C b/gcc/testsuite/g++.old-deja/g++.oliva/typeof1.C new file mode 100644 index 000000000..197abe6a5 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.oliva/typeof1.C @@ -0,0 +1,19 @@ +// { dg-do assemble } + +// Copyright (C) 1999 Free Software Foundation + +// by Alexandre Oliva <oliva@dcc.unicamp.br> + +struct B { + int i; +}; + +template <class T> void foo(T b) { + b.T::i; // ok + // b.__typeof__(b)::i; // parse error, should this be accepted? + typedef T t1; + b.t1::i; // ok + typedef __typeof__(b) t2; +} + +template void foo(B); // not needed for the crash |