diff options
Diffstat (limited to 'gcc/testsuite')
550 files changed, 1451 insertions, 12059 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index b15599cd813..ade3278bf5a 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,452 @@ +Fri Mar 26 00:50:46 1999 Jeffrey A Law (law@cygnus.com) + + * gcc.c-torture/execute/990326-1.c: New test from Charles Hannum. + +1999-03-26 Craig Burley <craig@jcb-sc.com> + + * g77.f-torture/execute/19990325-0.f: New test. + * g77.f-torture/execute/19990325-1.f: New test. + +Wed Mar 24 22:50:50 1999 Jeffrey A Law (law@cygnus.com) + + * gcc.c-torture/execute/990324-1.c: New test. + +1999-03-13 Craig Burley <craig@jcb-sc.com> + + * g77.f-torture/execute/19990313-2.f: New test. + * g77.f-torture/execute/19990313-3.f: New test. + +1999-03-13 Craig Burley <craig@jcb-sc.com> + + * g77.f-torture/execute/19990313-0.f: New test. + * g77.f-torture/execute/19990313-1.f: New test. + +1999-03-08 Craig Burley <craig@jcb-sc.com> + + * g77.f-torture/execute/19981119-0.f: Improve testiness. + +1999-03-08 Craig Burley <craig@jcb-sc.com> + + * g77.f-torture/compile/19990305-0.f: New test. + * g77.f-torture/execute/19981119-0.f: New test. + +1999-03-08 Craig Burley <craig@jcb-sc.com> + + * g77.f-torture/execute/970625-2.f: call ABORT if final + result is not correct, instead of just printing it. + Add this checking via newly introduced obfuscation, to + trip up buggy front ends. + +1999-03-07 Craig Burley <craig@jcb-sc.com> + + * g77.f-torture/compile/960317-1.f: Moved from being + in execute/. (Somehow I didn't notice "SUBROUTINE...".) + +1999-03-06 Craig Burley <craig@jcb-sc.com> + + * g77.f-torture/execute/960317-1.f: New (old) test. + * g77.f-torture/execute/970625-2.f: Ditto. + +Mon Mar 1 23:29:14 1999 Jeffrey A Law (law@cygnus.com) + + * g++.old-deja/g++.law/weak1.C: New test. + +1999-02-28 17:59 -0500 Zack Weinberg <zack@rabi.columbia.edu> + + * gcc.c-torture/execute/990119-1.c: Renamed to... + * gcc.dg/990119-1.c: this, so it will only be tested once + (it's a preprocessor test, it doesn't need to be run at + multiple optimization levels). + +1999-02-27 13:34 -0500 Zack Weinberg <zack@rabi.columbia.edu> + + * lib/g++.exp: Don't add incdir=$base_dir/../include to + ALWAYS_CXXFLAGS. + +1999-02-24 Craig Burley <craig@jcb-sc.com> + + * gcc.f-torture/noncompile/19981216-0.f: Renamed from... + * gcc.f-torture/compile/19981216-0.f: ...as it is expected + to not be compilable by current g77. + +1999-02-24 Nick Clifton <nickc@cygnus.com> + + * lib/c-torture.exp: Add -O3 to TORTURE_OPTIONS list. + +Mon Feb 22 01:15:08 1999 Jeffrey A Law (law@cygnus.com) + + * gcc.c-torture/execute/990222-1.c: New test. + +1999-02-19 Craig Burley <craig@jcb-sc.com> + + * g77.f-torture/compile/19990218-0.f: New test. + * g77.f-torture/noncompile/19990218-1.f: New test. + +1999-02-18 Craig Burley <craig@jcb-sc.com> + + * g77.f-torture/compile/19981216-0.f: New test. + +Sun Feb 14 01:26:29 1999 Jeffrey A Law (law@cygnus.com) + + * gcc.dg/990214-1.c: New test. + +Sat Feb 13 00:43:52 1999 Jeffrey A Law (law@cygnus.com) + + * gcc.dg/990213-2.c: New test. + + * gcc.dg/990213-1.c: New test. + +Fri Feb 12 11:04:35 1999 Jeffrey A Law (law@cygnus.com) + + * gcc.c-torture/990106-2.c: Update to work on targets with 16bit + ints. + +1999-02-11 Nick Clifton <nickc@cygnus.com> + + * lib/chill.exp: Fix typo: doesn'timeout -> doesn't + +Thu Feb 11 01:12:12 1999 Jeffrey A Law (law@cygnus.com) + + * gcc.c-torture/execute/990211-1.c: New test from Nathan SIdwell. + +Wed Feb 10 13:08:12 1999 Jonathan Larmour <jlarmour@cygnus.co.uk> + + * gcc.dg/special/ecos.exp: New test driver for new tests with + special requirements. + + * gcc.dg/special/alias-1.c: New test. + * gcc.dg/special/gcsec-1.c: New test. + * gcc.dg/special/weak-1.c: New test. + * gcc.dg/special/weak-1a.c: Accompanying file to weak-1.c. + * gcc.dg/special/weak-2.c: New test. + * gcc.dg/special/weak-2a.c: Accompanying file to weak-2.c. + * gcc.dg/special/weak-2b.c: Accompanying file to weak-2.c. + * gcc.dg/special/wkali-1.c: New test. + * gcc.dg/special/wkali-2.c: New test. + * gcc.dg/special/wkali-2a.c: Accompanying file to wkali-2.c. + * gcc.dg/special/wkali-2b.c: Accompanying file to wkali-2.c. + +Wed Feb 10 12:15:35 1999 Felix Lee <flee@cygnus.com> + + * lib/c-torture.exp (c-torture-compile): Pull out code for + analyzing gcc error messages. + (c-torture-execute): Likewise. Fix some (harmless) false + positives. + * lib/gcc.exp (gcc_check_compile): New function. + +Mon Feb 8 21:42:57 1999 Richard Henderson <rth@cygnus.com> + + * gcc.c-torture/execute/990208-1.c: New test. + +1999-02-07 Jonathan Larmour <jlarmour@cygnus.co.uk> + + * g++.dg/special/ecos.exp: New driver for new tests with special + requirements + + * g++.dg/special/conpr-1.C: New test + * g++.dg/special/conpr-2.C: New test + * g++.dg/special/conpr-2a.C: New test + * g++.dg/special/conpr-3.C: New test + * g++.dg/special/conpr-3a.C: New test + * g++.dg/special/conpr-3b.C: New test + + * lib/g++-dg.exp: New driver file, based on lib/gcc-dg.exp to + allow g++ to use the dg driver + + * README: Add comment about g++.dg directory + +Sat Feb 6 18:00:38 1999 Jeffrey A Law (law@cygnus.com) + + * README: Update email addresses. + +Sat Jan 30 16:22:47 1999 Richard Henderson <rth@cygnus.com> + + * gcc.c-torture/execute/990130-1.c: New test. + +Sat Jan 30 11:10:06 1999 Jeffrey A Law (law@cygnus.com) + + * gcc.dg/990130-1.c: New test. + +Sun Jan 17 00:02:33 1999 Jeffrey A Law (law@cygnus.com) + + * gcc.dg/990117-1.c: New test. + + * gcc.c-torture/compile/990117-1.c: New test from Horst von Brand. + + * gcc.c-torture/execute/990117-1.c: New test from HJ Lu. + +Fri Jan 15 02:52:00 1999 Jeffrey A Law (law@cygnus.com) + + * g77.f-torture/compile/990115-1.f: New test. + +Thu Jan 7 23:39:47 1999 Jeffrey A Law (law@cygnus.com) + + * gcc.c-torture/compile/990107-1.c: New test + +Wed Jan 6 02:21:59 1999 Jeffrey A Law (law@cygnus.com) + + * gcc.c-torture/execute/990106-2.c: New test. + + * gcc.c-torture/execute/990106-1.c: New test. + +Wed Dec 30 23:05:28 1998 Zack Weinberg <zack@rabi.columbia.edu> + + * gcc.c-torture/compile/981223-1.c: New test. + +Tue Dec 29 11:33:25 1998 Richard Henderson <rth@cygnus.com> + + * gcc.c-torture/execute/bcp-1.c (bad10): Rename from opt3. + (opt3): Rename from opt4 and disable. + +1998-12-20 Alexandre Oliva <oliva@dcc.unicamp.br> + + * g++.old-deja/g++.pt/ptrmem5.C: New test. + +1998-12-15 Alexandre Oliva <oliva@dcc.unicamp.br> + + * g++.old-deja/g++.other/conv5.C: New test. + +Fri Dec 11 10:25:57 1998 Jeffrey A Law (law@cygnus.com) + + * g++.old-deja/g++.benjamin/p12475.C: Expect failure on mips64 targets. + +Fri Dec 11 01:12:45 1998 Zack Weinberg <zack@rabi.columbia.edu> + + * gcc.c-torture/compile/981211-1.c: New test. + +1998-12-09 Alexandre Oliva <oliva@dcc.unicamp.br> + + * gcc.dg/ultrasp1.c: empty dg-options, avoid `long long' warnings + + * g++.old-deja/g++.pt/instantiate6.C: linker error, not crash + +Tue Dec 8 22:50:04 1998 Franz Sirl <Franz.Sirl-kernel@lauterbach.com> + + * gcc.special/930510-1.c: Make C9X safe. + * gcc.misc-tests/gcov-1.c Similarly. + * gcc.misc-tests/gcov-2.c Similarly. + +1998-12-06 Alexandre Oliva <oliva@dcc.unicamp.br> + + * gcc.dg/ultrasp1.c: New test. + +Sun Dec 6 00:40:12 1998 Richard Henderson <rth@cygnus.com> + + * gcc.c-torture/execute/981206.c: New test. + +1998-12-06 Alexandre Oliva <oliva@dcc.unicamp.br> + + * g++.old-deja/g++.ns/template7.C: New test. + + * g++.old-deja/g++.other/expr1.C: New test. + + * g++.old-deja/g++.eh/tmpl3.C: New test. + + * g++.old-deja/g++.eh/tmpl2.C: New test. + +1998-12-04 Alexandre Oliva <oliva@dcc.unicamp.br> + + * g++.old-deja/g++.other/using5.C: usified using[567].C here + * g++.old-deja/g++.other/using6.C: removed + * g++.old-deja/g++.other/using7.C: Mark Mitchel removed it + + * g++.old-deja/g++.pt/spec20.C: Re-insert non-bogus ERROR marks. + +1998-12-03 Alexandre Oliva <oliva@dcc.unicamp.br> + + * g++.old-deja/g++.pt/overload8.C: New test. + + * g++.old-deja/g++.pt/overload7.C: New test. + + * g++.old-deja/g++.pt/spec20.C: ERROR marks were bogus + + * lib/old-dejagnu.exp (old-dejagnu): ignore collect recompiling + and relinking messages + * lib/g++.exp (g++_target_compile): remove .rpo file when + compiling with -frepo + +1998-12-01 Alexandre Oliva <oliva@dcc.unicamp.br> + + * g++.old-deja/g++.pt/lookup6.C: New test. + +1998-11-27 Alexandre Oliva <oliva@dcc.unicamp.br> + + * g++.old-deja/g++.pt/explicit76.C: New test. + + * g++.old-deja/g++.pt/friend38.C: New test. + + * g++.old-deja/g++.ns/crash2.C: New test. + + * g++.old-deja/g++.pt/defarg8.C: New test. + + * g++.old-deja/g++.pt/instantiate6.C: New test. + + * g++.old-deja/g++.pt/static6.C: New test. + + * g++.old-deja/g++.pt/decl2.C: New test. + +1998-11-26 Alexandre Oliva <oliva@dcc.unicamp.br> + + * g++.old-deja/g++.other/lookup5.C: New test. Not sure the + problem is actually related with name lookup, but so what? :-) + + * g++.old-deja/g++.pt/friend37.C: New test. + +1998-11-25 Dave Love <d.love@dl.ac.uk> + + * g77.f-torture/execute/u77-test.f (main): Avoid testing [f]statb + element, which fails on some systems. + + * g77.f-torture/execute/labug1.f: New test. + +Sat Nov 21 21:41:05 1998 Jeffrey A Law (law@cygnus.com) + + * gcc.c-torture/execute/980526-1.c: Do nothing if NO_LABEL_VALUES + is defined. + +1998-11-18 Dave Love <d.love@dl.ac.uk> + + * g77.f-torture/compile/981117-1.f: New test. + +1998-11-16 Alexandre Oliva <oliva@dcc.unicamp.br> + + * g++.old-deja/g++.eh/throw2.C: New test. CV-qualifiers are not + properly discarded. + +1998-11-07 Gerald Pfeifer <pfeifer@dbai.tuwien.ac.at> + + * README: New file, general information about the testsuite and + new description of the various C++ test subdirectories. + * README.g++: Eliminate obsolete information, update and move most + relevant stuff to README. + +Sat Nov 7 02:55:55 1998 Richard Henderson <rth@cygnus.com> + + * gcc.c-torture/compile/981107-1.c: New test. + +Mon Nov 2 11:16:03 1998 Doug Evans <devans@canuck.cygnus.com> + + * execute/memcpy-bi.c: New testcase. + +1998-10-31 Alexandre Oliva <oliva@dcc.unicamp.br> + + * g++.old-deja/g++.pt/sizeof3.C: a similar testcase not involving + base classes + + * g++.old-deja/g++.pt/sizeof2.C: incorrect specialization of base + template is selected + + * g++.old-deja/g++.ext/arrnew2.C: if new T[n](i) is accepted for + classes, it should be accepted for all types. + + * g++.old-deja/g++.eh/sjlj1.C: test checked sjlj-exception + + * g++.old-deja/g++.pt/spec24.C: ensure that template + specializations start with template headers + +1998-10-29 Alexandre Oliva <oliva@dcc.unicamp.br> + + * g++.old-deja/g++.other/dcast2.C: cannot dynamic downcast &x + + * g++.old-deja/g++.other/init9.C: test cross initialization of + non-POD types + +1998-10-27 Alexandre Oliva <oliva@dcc.unicamp.br> + + * lib/old-dejagnu.exp (old-dejagnu): document `Additional sources' + +Thu Oct 22 16:01:44 1998 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> + + * compile/981022-1.c, compile/981022-1.x: New test and driver. + +Mon Oct 19 14:03:07 1998 Jeffrey A Law (law@cygnus.com) + + * 981019-1.c: New test. + +Wed Oct 14 21:11:19 1998 Robert Lipe <robertl@dgii.com> + + * lib/objc-torture.exp (objc-torture-execute): Add -I so we can + find objc headers. + +1998-10-14 Andreas Schwab <schwab@issan.cs.uni-dortmund.de> + + * compile/981001-4.c: Remove use of GCC extension that triggers a + compiler bug. + +1998-10-13 Alexandre Oliva <oliva@dcc.unicamp.br> + + * lib/old-dejagnu.exp (old-dejagnu): support `Additional sources:' + +1998-10-12 Alexandre Oliva <oliva@dcc.unicamp.br> + + * g++.old-deja/g++.pt/explicit74.C: New test. Explicit + instantiation of template produces incorrect code for delete + expression. + + * g++.old-deja/g++.pt/instantiate5.C: New test. `global + constructors' name is not unique + * g++.old-deja/g++.pt/instantiate5.cc: ditto + * g++.old-deja/g++.pt/instantiate5-main.cc: ditto + + * g++.old-deja/g++.other/init8.C: New test. uninitialized + automatic array of const is ill-formed + + * g++.old-deja/g++.pt/ttp53.C: New test. incorrect substitution + of template parameter? + + * g++.old-deja/g++.other/conv3.C: New test. conversion discards + const + + * g++.old-deja/g++.other/pmf2.C: New test. invalid + pointer-to-member expression + + * g++.old-deja/g++.other/friend5.C: New test. bogus friend + declaration causes ICE + +1998-10-11 Alexandre Oliva <oliva@dcc.unicamp.br> + + * g++.old-deja/g++.ns/main1.C: New test. main() should only be + reserved in the global namespace + + * g++.old-deja/g++.pt/instantiate4.C: New test: -frepo does not + generate needed virtual table + + * lib/old-dejagnu.exp (old-dejagnu): support `Build then link:' + +1998-10-10 Dariush Eslimi <eslimi@loran.com> + + * g++.old-deja/g++.ext/typeof1.C: New test; typeof based on + template-dependent type + +1998-10-10 Alexandre Oliva <oliva@dcc.unicamp.br> + + * g++.old-deja/g++.brendan/parse3.C: XFAILs, not ERRORs + * g++.old-deja/g++.brendan/parse5.C: XFAILs, not ERRORs + * g++.old-deja/g++.brendan/parse6.C: XFAILs, not ERRORs + + * g++.old-deja/g++.other/using5.C: New test; using decl from base + class should be usable as argument of member function + * g++.old-deja/g++.other/using6.C: New test; using decl from base + class should be usable as return type of member function + * g++.old-deja/g++.other/using7.C: New test; using decl from base + class should be usable as type of data member + + * g++.old-deja/g++.ns/extern1.C: fix XFAIL mark + +Fri Oct 9 19:19:19 1998 Jeffrey A Law (law@cygnus.com) + + * gcc.c-torture/special/920521-1.c: Fix bogus test. + +Thu Oct 8 19:14:05 1998 Nick Clifton <nickc@cygnus.com> + + * gcc.dg/dll-?.c Add thumb to target list. + Fix assembler scan patterns to match current assembler output. + 1998-10-08 Alexandre Oliva <oliva@dcc.unicamp.br> + * g++.old-deja/g++.pt/expr6.C: New test. operator?: breaks + matching of template brackets. + * g++.old-deja/g++.other/using4.C: New test. Test using declarations of methods from base classes. diff --git a/gcc/testsuite/README.g++ b/gcc/testsuite/README.g++ index 833d5ed603b..640ab2e9282 100644 --- a/gcc/testsuite/README.g++ +++ b/gcc/testsuite/README.g++ @@ -1,64 +1,2 @@ -This file needs a little updating, but is pretty close. Here are some -random last minute notes: - -make check and make check-g++ aren't in FSF's gcc yet, I am planning -on getting this work into the tree some time... - -> and the command - -> runtest --tool g++ --srcdir ./testsuite - -> doesn't work. I got it to work by explicitly setting CXX and CXXFLAGS -> on the command line, e.g. - -> runtest --tool g++ --srcdir ./testsuite CXX=g++ CXXFLAGS="" - -site.exp updated to have right CXXFLAGS and CXX, but not at the FSF yet. - - - This is a collection of tests for g++, the FSF's C++ compiler. The -driver that runs the testsuite is called DejaGnu. If you do not have -DejaGnu yet, you will need to get it (ftp://ftp.cygnus.com/pub/dejagnu). -You will need a snapshot of DejaGnu of 02/21/97 or later. The tests -were developed and/or collected by Cygnus Support. These tests are -included "as is". If any of the tests fail, don't report a bug. Bug -reports for DejaGnu can go to bug-dejagnu@prep.ai.mit.edu. Discussion -and comments about this testsuite can be sent to me, at the address -below. - - Since these are part of the development source tree at Cygnus, this -tar file is supposed to be untarred so that the testsuite directory is -in the gcc source tree. Most of the time DejaGnu is run by hand using -"runtest", but as we believe in solid testing, we've integrated it -into the Makefile as a target. We normally use the testsuite by doing -a "make all; make check-g++" at the top level and building and testing -our whole tree. If you have both the gcc testsuite and the g++ -testsuite, you can check both with the "make check" command. - - DejaGnu can be run either installed, or uninstalled. Usually it gets -installed so that anyone can just run the tests without having to -configure or build DejaGnu. - - To run the tests, first change to the gcc-2.7.1 directory, then type: - - runtest --tool g++ --srcdir ./testsuite - -Here's a brief explanation. - -runtest - Is the name used to invoke DejaGnu. If DejaGnu is not - install this will be the relative path name for runtest. - ---tool - This tells DejaGnu which tool you are testing. It is - mainly used to find the testsuite directories for a - particular tool when several testsuites are in the - same directory. (like the gcc and g++ testsuites) - ---srcdir - This points to the top level of the directory - containing the sources of the testsuite. This is - ./testsuite if you are in the directory that has the - testsuite directory. - - - Mike Stump - mrs@cygnus.com - FSF C++ developer +Here are some random last minute notes by this file's original maintainer, +Mike Stump <mrs@cygnus.com>: diff --git a/gcc/testsuite/g++.old-deja/g++.benjamin/p12475.C b/gcc/testsuite/g++.old-deja/g++.benjamin/p12475.C index 6e911a384bc..4f9d8b55730 100644 --- a/gcc/testsuite/g++.old-deja/g++.benjamin/p12475.C +++ b/gcc/testsuite/g++.old-deja/g++.benjamin/p12475.C @@ -2,4 +2,4 @@ // prms-id: 12475 // excess errors test - XFAIL alpha*-*-* mips64*-*-* -enum huh { start =-2147483648, next }; // WARNING - , XFAIL sparc64-*-* alpha*-*-* +enum huh { start =-2147483648, next }; // WARNING - , XFAIL sparc64-*-* alpha*-*-* mips64*-*-* diff --git a/gcc/testsuite/g++.old-deja/g++.benjamin/p15561.C b/gcc/testsuite/g++.old-deja/g++.benjamin/p15561.C deleted file mode 100644 index 3dedd0c5bad..00000000000 --- a/gcc/testsuite/g++.old-deja/g++.benjamin/p15561.C +++ /dev/null @@ -1,194 +0,0 @@ -//980418 bkoz reduced from kumar's g++/15561 -// Build don't link: -// prms-id: 15561 - -extern int errno; -extern int write (int, const void *, long unsigned int ) ; - -/* to debug -#ifdef BUG -*/ -//this crashes -typedef long unsigned int size_t; -//typedef unsigned long size_t; -//this is ok -//typedef unsigned int size_t; - -class exception { -public: - exception () { } - virtual ~exception () { } - virtual const char* what () const; -}; - -class bad_alloc : public exception { -public: - virtual const char* what() const throw() { return "bad_alloc"; } -}; - -struct nothrow_t {}; -extern const nothrow_t nothrow; - -typedef void (*new_handler)(); -new_handler set_new_handler (new_handler); - -void *operator new (size_t) throw (std::bad_alloc); -void *operator new[] (size_t) throw (std::bad_alloc); -void operator delete (void *) throw(); -void operator delete[] (void *) throw(); -void *operator new (size_t, const nothrow_t&) throw(); -void *operator new[] (size_t, const nothrow_t&) throw(); -void operator delete (void *, const nothrow_t&) throw(); -void operator delete[] (void *, const nothrow_t&) throw(); -inline void *operator new(size_t, void *place) throw() { return place; } -inline void *operator new[](size_t, void *place) throw() { return place; } - -/* to debug -#else -#include <new> -#endif -*/ - -//from kumar's ace file -typedef unsigned long u_long; -typedef int ACE_thread_t; -typedef int ACE_hthread_t; -typedef int ACE_thread_key_t; -typedef int ssize_t; -typedef int ACE_HANDLE; -typedef ACE_HANDLE ACE_SOCKET; - -struct ACE_OVERLAPPED -{ - u_long Internal; - u_long InternalHigh; - u_long Offset; - u_long OffsetHigh; - ACE_HANDLE hEvent; -}; - -struct strbuf { - int maxlen; - int len; - char *buf; -}; - -struct flock { - short l_type; - short l_whence; - long l_start; - long l_len; - short l_pid; - short l_xxx; -}; - -class ACE_OS -{ -public: - struct ace_flock_t - { - void dump (void) const; - struct flock lock_; - ACE_HANDLE handle_; - }; - static ssize_t write (ACE_HANDLE handle, - const void *buf, - size_t nbyte); - static ssize_t write (ACE_HANDLE handle, - const void *buf, - size_t nbyte, - ACE_OVERLAPPED *); - - static void *memcpy (void *t, - const void *s, - size_t len); - - static int putmsg (ACE_HANDLE handle, - const struct strbuf *ctl, - const struct strbuf *data, - int flags); - - static ACE_thread_t NULL_thread; - static ACE_hthread_t NULL_hthread; - static ACE_thread_key_t NULL_key; - static void mutex_lock_cleanup (void *mutex); -private: - ACE_OS (void); -}; - - - -inline ssize_t -ACE_OS::write (ACE_HANDLE handle, const void *buf, size_t nbyte) -{ - do { - ssize_t ace_result_ = -1 ; - ace_result_ = ace_result_; - return ::write (handle, buf, nbyte) ; } while (0) ; -} - -inline ssize_t -ACE_OS::write (ACE_HANDLE handle, const void *buf, size_t nbyte, - ACE_OVERLAPPED *overlapped) -{ - overlapped = overlapped; - return ACE_OS::write (handle, buf, nbyte); -} - - -inline int -ACE_OS::putmsg (ACE_HANDLE handle, const struct strbuf *ctl, - const struct strbuf *data, int flags) -{ - { - if (& flags ) - ; - } ; - if (ctl == 0 && data == 0) - { - errno = 22 ; - return 0; - } - - else if (ctl != 0) - return ACE_OS::write (handle, ctl->buf, ctl->len); - else if (data != 0) - return ACE_OS::write (handle, data->buf, data->len); - else - { - char *buf; - do - { - buf = new char [ctl->len + data->len] ; - if ( buf == 0) - { - errno = 12 ; - return -1 ; - } - } - while (0) ; - ACE_OS::memcpy (buf, ctl->buf, ctl->len); - ACE_OS::memcpy (buf + ctl->len, data->buf, data->len); - int result = ACE_OS::write (handle, buf, ctl->len + data->len); - delete [] buf; - return result; - } -} - -int main() -{ - return (1); -} - - - - - - - - - - - - - diff --git a/gcc/testsuite/g++.old-deja/g++.benjamin/tem03.C b/gcc/testsuite/g++.old-deja/g++.benjamin/tem03.C index b74e2640203..abb956f8797 100644 --- a/gcc/testsuite/g++.old-deja/g++.benjamin/tem03.C +++ b/gcc/testsuite/g++.old-deja/g++.benjamin/tem03.C @@ -83,7 +83,7 @@ public: template <class T10, int i> struct Xfour {// ERROR - .* int T10; // ERROR - .* void f(){ - char T10; // ERROR - .* + char T10; } }; diff --git a/gcc/testsuite/g++.old-deja/g++.benjamin/tem06.C b/gcc/testsuite/g++.old-deja/g++.benjamin/tem06.C index 9fcd6301caa..e55ee6aafb4 100644 --- a/gcc/testsuite/g++.old-deja/g++.benjamin/tem06.C +++ b/gcc/testsuite/g++.old-deja/g++.benjamin/tem06.C @@ -19,7 +19,7 @@ void blah (const T &) { x (4); }; -main () { +int main () { const foo<int> v; blah (v); } diff --git a/gcc/testsuite/g++.old-deja/g++.benjamin/typedef01.C b/gcc/testsuite/g++.old-deja/g++.benjamin/typedef01.C index 179740d556c..ba6af18b632 100644 --- a/gcc/testsuite/g++.old-deja/g++.benjamin/typedef01.C +++ b/gcc/testsuite/g++.old-deja/g++.benjamin/typedef01.C @@ -40,12 +40,7 @@ struct S { typedef struct S T; S a = T(); // OK -struct T * p; // error +struct T * p; // ERROR - using typedef after struct //case01 typedef bool short;// ERROR - .* - - - - - diff --git a/gcc/testsuite/g++.old-deja/g++.benjamin/warn02.C b/gcc/testsuite/g++.old-deja/g++.benjamin/warn02.C index a60a2d7e150..e63d43cbec9 100644 --- a/gcc/testsuite/g++.old-deja/g++.benjamin/warn02.C +++ b/gcc/testsuite/g++.old-deja/g++.benjamin/warn02.C @@ -31,16 +31,16 @@ class C class D { public: - int foo2() {return b;} // WARNING - - int foo2() {return b;} // WARNING - + int foo2() {return b;} + int foo2() {return b;} // ERROR - int b; }; class E { public: - int foo2(); // WARNING - - int foo2(); // WARNING - + int foo2(); + int foo2(); // ERROR - int b; }; diff --git a/gcc/testsuite/g++.old-deja/g++.bob/inherit1.C b/gcc/testsuite/g++.old-deja/g++.bob/inherit1.C index 4e77de34884..765014bc66d 100644 --- a/gcc/testsuite/g++.old-deja/g++.bob/inherit1.C +++ b/gcc/testsuite/g++.old-deja/g++.bob/inherit1.C @@ -1,25 +1 @@ -// Build don't link: -class A { -char str[10]; -public: - char* m1 () { return str;}; -}; - -class C : public A { -public: -}; - -class B : public A { -public: - char* m1 () { C::m1(); return ""; } // ERROR - -}; - -main () { -A a; -B b; -C c; - -a.m1(); -c.m1(); -b.m1(); -} +int main () { diff --git a/gcc/testsuite/g++.old-deja/g++.bob/packed1.C b/gcc/testsuite/g++.old-deja/g++.bob/packed1.C index 27ae03e4a05..b5287f33795 100644 --- a/gcc/testsuite/g++.old-deja/g++.bob/packed1.C +++ b/gcc/testsuite/g++.old-deja/g++.bob/packed1.C @@ -1,16 +1 @@ -main() { - struct s - { - int a; - short b; - } __attribute__((packed)) t; - - if (sizeof (t) != (sizeof(int)+sizeof(short))) - { - return 1; - } - else - { - return 0; - } -} +int diff --git a/gcc/testsuite/g++.old-deja/g++.bob/protected1.C b/gcc/testsuite/g++.old-deja/g++.bob/protected1.C index e83f3e40b73..b5287f33795 100644 --- a/gcc/testsuite/g++.old-deja/g++.bob/protected1.C +++ b/gcc/testsuite/g++.old-deja/g++.bob/protected1.C @@ -1,41 +1 @@ -// Build don't link: -class A { -public: - int i; - A(int j) : i(j){} -}; - -class B : protected A { -public: - B(int j) : A(j){} - void f(){ - A k(*this); - } -}; - -class C : protected B { -public: - C(int j) : B(j){} - void f(); - - void g(){ - A k(i); - } -}; - - -class D : public C { -public: - D(int w) : C(i) {} - void j() { A k(*this); } - void h() { i=3; } -}; - -void C::f() { - A k(*this); -} - -B b(3); -main() { - A *z = &b; // ERROR - -} +int diff --git a/gcc/testsuite/g++.old-deja/g++.bob/template3.C b/gcc/testsuite/g++.old-deja/g++.bob/template3.C index 17378425a26..b5287f33795 100644 --- a/gcc/testsuite/g++.old-deja/g++.bob/template3.C +++ b/gcc/testsuite/g++.old-deja/g++.bob/template3.C @@ -1,48 +1 @@ -// Build don't link: -// prms-id: 9979 - -template < class Referencee > -class Referencer -{ -public: - Referencer() {} -}; - -template <class T> -class List -{ -public: - List() {} -}; - -template<class T, class KEY> -class Dictionary -{ -public: - Dictionary() : i_buckets (new List<T>[1234]) {} - ~Dictionary() { delete [] i_buckets; } - - List<T> * i_buckets; -}; - -class Exchangeable {}; -class ExchangeableHandle {}; - -class ExchangeableList - : public Dictionary<Referencer<Exchangeable>, ExchangeableHandle> -{ -public: - ExchangeableList(int size=0); -}; - -class ObjectExchange -{ -public: - ObjectExchange() {}; - - ExchangeableList i_theWatchList; // Instruments being monitored -}; - -main() -{ -} +int diff --git a/gcc/testsuite/g++.old-deja/g++.bob/template4.C b/gcc/testsuite/g++.old-deja/g++.bob/template4.C index 8d86fa37ab6..b5287f33795 100644 --- a/gcc/testsuite/g++.old-deja/g++.bob/template4.C +++ b/gcc/testsuite/g++.old-deja/g++.bob/template4.C @@ -1,20 +1 @@ -// prms-id: 10166 - -template <class A> -class B { - public: - int f() { - for(int x=0;x<10;x++) { - continue; - return 1; - } - return 0; - } - private: - A w; -}; - -main() { - B<int> c; - return c.f(); -} +int diff --git a/gcc/testsuite/g++.old-deja/g++.brendan/README b/gcc/testsuite/g++.old-deja/g++.brendan/README index 81119572caa..e69de29bb2d 100644 --- a/gcc/testsuite/g++.old-deja/g++.brendan/README +++ b/gcc/testsuite/g++.old-deja/g++.brendan/README @@ -1,41 +0,0 @@ -Note: nest4 misses a syntax error - -abstract - abstract functions -alignof - gcc alignof builtin -ambiguity - diagnosing ambiguities -arm - ARM cases -array-refs - arrays of references -bit-fields - bit fields -chainon - deaths cuz we call chainon() incorrectly -copy - copy constructors -crash - old compiler crashes/aborts -cvt - user-defined conversions -def-fns - default function generation (in add'n to copy) -enum-clash - int vs enum -enum - enumerated types -err-msg - error messages -friend - dealing with friend functions and classes -groff - crashes derived from groff code -init - initialization bugs -label - handling labels -line - line numbers in error messages -misc - miscellaneous tests that didn't fit another category -nest - nested types -new-array - doing new of an array -new - generic operator new bugs -operators - tests for various overloaded operators -parse - parser bugs -prepost - prefix/postfix operator ++/-- -ptolemy - bugs derived from ptolemy -recurse - infinite recursion in the compiler -redecl - handling redeclarations -scope - managing scopes -shadow - shadowing of params, etc -sizeof - ARM compliance w/ sizeof operator -sorry - old "sorry, not implemented" messages -static - handling static data -template - template bugs -union - handling unions -visibility - access control and visibility checking -warnings - warning messages - diff --git a/gcc/testsuite/g++.old-deja/g++.brendan/arm1.C b/gcc/testsuite/g++.old-deja/g++.brendan/arm1.C index 74091f8cce5..b5287f33795 100644 --- a/gcc/testsuite/g++.old-deja/g++.brendan/arm1.C +++ b/gcc/testsuite/g++.old-deja/g++.brendan/arm1.C @@ -1,10 +1 @@ -// Build don't link: -// Special g++ Options: -pedantic-errors -// GROUPS passed ARM-compliance -// ARM $5.7, it's illegal to do math on a `void*'. - -main() -{ - void *p; - ++p;// ERROR - .* -} +int diff --git a/gcc/testsuite/g++.old-deja/g++.brendan/bit-fields2.C b/gcc/testsuite/g++.old-deja/g++.brendan/bit-fields2.C index dae2726b89c..9f32b32bf36 100644 --- a/gcc/testsuite/g++.old-deja/g++.brendan/bit-fields2.C +++ b/gcc/testsuite/g++.old-deja/g++.brendan/bit-fields2.C @@ -1,13 +1,3 @@ -// Build don't link: -// GROUPS passed bit-fields - struct { - char c; - int i:8; - } s; - - main() - { - int &ir = s.i; - int *ip = &s.i;// ERROR - .* , XFAIL *-*-* - ir = 10; - } + int main() + int &ir = s.i; // ERROR - address of bitfield + int *ip = &s.i; // ERROR - address of bitfield diff --git a/gcc/testsuite/g++.old-deja/g++.brendan/bool1.C b/gcc/testsuite/g++.old-deja/g++.brendan/bool1.C index bab925521ce..b5287f33795 100644 --- a/gcc/testsuite/g++.old-deja/g++.brendan/bool1.C +++ b/gcc/testsuite/g++.old-deja/g++.brendan/bool1.C @@ -1,11 +1 @@ -// Build don't link: -// GROUPS passed boolean -main() -{ - typedef char Boolean; // Instrinsic.h - Boolean c = false; - bool b = true; - - if (!c != !b) - ; -} +int diff --git a/gcc/testsuite/g++.old-deja/g++.brendan/copy1.C b/gcc/testsuite/g++.old-deja/g++.brendan/copy1.C index 38242fbb8be..b5287f33795 100644 --- a/gcc/testsuite/g++.old-deja/g++.brendan/copy1.C +++ b/gcc/testsuite/g++.old-deja/g++.brendan/copy1.C @@ -1,21 +1 @@ -// GROUPS passed copy-ctors -extern "C" void printf (char *, ...); -int count = 0; - -class C { -public: - C (int) { count++; } - operator int () { return 0; } -}; - - -main () -{ - C c1 (1); - C c2 (c1); - - if (count != 1) - printf ("FAIL\n"); - else - printf ("PASS\n"); -} +int diff --git a/gcc/testsuite/g++.old-deja/g++.brendan/copy2.C b/gcc/testsuite/g++.old-deja/g++.brendan/copy2.C index 9f93755dae4..b5287f33795 100644 --- a/gcc/testsuite/g++.old-deja/g++.brendan/copy2.C +++ b/gcc/testsuite/g++.old-deja/g++.brendan/copy2.C @@ -1,79 +1 @@ -// GROUPS passed copy-ctors -/* -The old g++ output is - -Item() -Compound() -Pre foo -foo -~Compound() -~Item() -Post foo -~Compound() -~Item() - -The output should be something like (produced from ATT 2.1) - -Item() -Compound() -Pre foo -Item(const Item& i) <------ missing above -foo -~Compound() -~Item() -Post foo -~Compound() -~Item() - -*/ - -extern "C" void printf (char *, ...); -extern "C" void exit (int); - -int count = 0; - -void -die (int x) -{ - if (x != ++count) - { - printf ("FAIL\n"); - exit (1); - } -} - - -class Item { - public: - Item() { die (1); } - Item(const Item& i) { die (4); } - ~Item() { count++; if (count != 7 && count != 10) die (-1); } -}; - - -class Compound { - Item i; - public: - Compound() { die (2); } - ~Compound() { count++; if (count != 6 && count != 9) die (-1); } -}; - - -void foo(Compound a) -{ - die (5); -} - - -main() -{ - Compound a; - - die (3); - foo(a); - - die (8); - - printf ("PASS\n"); -} - +int diff --git a/gcc/testsuite/g++.old-deja/g++.brendan/copy3.C b/gcc/testsuite/g++.old-deja/g++.brendan/copy3.C index 28b3306433b..b5287f33795 100644 --- a/gcc/testsuite/g++.old-deja/g++.brendan/copy3.C +++ b/gcc/testsuite/g++.old-deja/g++.brendan/copy3.C @@ -1,57 +1 @@ -// GROUPS passed copy-ctors -/* - -If I compile it with cfront (AT&T C++ Translator 2.00.02 08/25/89) and run it -I get: - - A::A() - A::A(const A&) - B::Bar() - A::~A() - A::~A() - -If I compile it with g++ (gcc version 2.2.2) and run it I get: - - A::A() - B::Bar() - A::~A() - A::~A() - -*/ -extern "C" void printf (char *, ...); -extern "C" void exit (int); - -int count = 0; - -void -die (int x) -{ - if (x != ++count) - { - printf ("FAIL\n"); - exit (1); - } -} - - -class A { -public: - A() { die (1); } - A(const A&) { die (2); } - ~A() { count++; if (count != 4 && count != 5) die (-1); } -}; - -class B : public A { -public: - void Bar() { die (3); } -}; - -void Foo(B b) { b.Bar(); } - -main() -{ - B b; - Foo(b); - - printf ("PASS\n"); -} +int diff --git a/gcc/testsuite/g++.old-deja/g++.brendan/copy5.C b/gcc/testsuite/g++.old-deja/g++.brendan/copy5.C index db63d75925b..b5287f33795 100644 --- a/gcc/testsuite/g++.old-deja/g++.brendan/copy5.C +++ b/gcc/testsuite/g++.old-deja/g++.brendan/copy5.C @@ -1,84 +1 @@ -// GROUPS passed copy-ctors -/* -bad: -sibelius402> a.out -a=5 a.virtMember()=30 -BaseClass::Increm --> {i=5, virtMember()=30} -a=7 a.virtMember()=30 -b=7 b.virtMember()=30 -BaseClass::Increm --> {i=7, virtMember()=999} -b=9 b.virtMember()=30 -sibelius403> - - good: - -sibelius406> a.out -a=5 a.virtMember()=30 -BaseClass::Increm --> {i=5, virtMember()=30} -a=7 a.virtMember()=30 -b=7 b.virtMember()=30 -BaseClass::Increm --> {i=7, virtMember()=30} -b=9 b.virtMember()=30 -*/ - -extern "C" void printf (char *, ...); -extern "C" void exit (int); - -void die () { printf ("FAIL\n"); exit (1); } - -class BaseClass { - - friend int operator != (const BaseClass irv, int x); - - int i; - -public: - - BaseClass( const BaseClass& ir ) : i(ir.i) {}; - BaseClass() : i(5) {}; - - virtual int virtMember() { return( 999 ); }; - - void Increm( int r ); -}; - -void BaseClass::Increm( int r ) -{ - if ((i == 5 && virtMember () == 30) - || (i == 7 && virtMember () == 30)) - i += r; - else - die (); -}; - -class DerivedClass : public BaseClass { -public: - int virtMember() { return( 30 ); }; -}; - -int operator != (const BaseClass irv, int x) { return irv.i != x; } - -main () -{ - DerivedClass a; - - if (a != 5 || a.virtMember () != 30) - die (); - - a.Increm(2); - - if (a != 7 || a.virtMember () != 30) - die (); - - DerivedClass b = a; - - if (b != 7 || a.virtMember () != 30) - die (); - - b.Increm(2); - - if (b != 9 || a.virtMember () != 30) - die (); - - printf ("PASS\n"); -} +int diff --git a/gcc/testsuite/g++.old-deja/g++.brendan/copy7.C b/gcc/testsuite/g++.old-deja/g++.brendan/copy7.C index c98d77f6d12..b5287f33795 100644 --- a/gcc/testsuite/g++.old-deja/g++.brendan/copy7.C +++ b/gcc/testsuite/g++.old-deja/g++.brendan/copy7.C @@ -1,29 +1 @@ -// GROUPS passed copy-ctors -extern "C" void printf (char *, ...); -extern "C" void exit (int); - -void die () { printf ("FAIL\n"); exit (1); } - -class B { -public: - B() {} - B(const B &) { printf ("PASS\n"); exit (0); }; -private: - int x; -}; - -class A : public B { -public: - A() {} - - A(const B &) { printf ("FAIL\n"); exit (1); } -}; - -main() -{ - A a; - A b(a); - - printf ("FAIL\n"); - return 0; -} +int diff --git a/gcc/testsuite/g++.old-deja/g++.brendan/copy9.C b/gcc/testsuite/g++.old-deja/g++.brendan/copy9.C index 9c5114a322f..b5287f33795 100644 --- a/gcc/testsuite/g++.old-deja/g++.brendan/copy9.C +++ b/gcc/testsuite/g++.old-deja/g++.brendan/copy9.C @@ -1,40 +1 @@ -// GROUPS passed copy-ctors -#include <iostream.h> - -// token types: from state parser -const int T_EOF = 257; -const int T_ERROR = 258; -const int T_Float = 259; -const int T_Int = 260; -const int T_ID = 261; -const int T_STRING = 262; - -class Complex; -class State; - -// token, from state parser. -class ParseToken { -public: - int tok; - union { - char cval; - const char *sval; - int intval; - double doubleval; - Complex* Complexval; - const State* s; - }; - ParseToken () { tok = 0; intval = 0;} -}; - -main () { - ParseToken a; - a.tok = T_Float; - a.doubleval = 23.2; - ParseToken b(a); - - if (b.doubleval == 23.2) - cout << "PASS\n"; - else - cout << "FAIL\n"; -} +int diff --git a/gcc/testsuite/g++.old-deja/g++.brendan/crash11.C b/gcc/testsuite/g++.old-deja/g++.brendan/crash11.C index f03953ab20e..f655fbeecff 100644 --- a/gcc/testsuite/g++.old-deja/g++.brendan/crash11.C +++ b/gcc/testsuite/g++.old-deja/g++.brendan/crash11.C @@ -1,23 +1,3 @@ -// Build don't link: -// GROUPS passed old-abort -extern "C" void printf (char *, ...); - -class A { - int i; - int j; - public: - int h; - A() { i=10; j=20; } - virtual void f1() { printf("i=%d j=%d\n",i,j); } - friend virtual void f2() { printf("i=%d j=%d\n",i,j); }// ERROR - virtual.* -}; - -class B : public A { - public: - virtual void f1() { printf("i=%d j=%d\n",i,j); }// ERROR - member.*// ERROR - member.* - friend virtual void f2() { printf("i=%d j=%d\n",i,j); }// ERROR - virtual.*// ERROR - member.*// ERROR - member.* -}; - -main() { - A * a = new A; -} + int i; // ERROR - private + int j; // ERROR - private +int diff --git a/gcc/testsuite/g++.old-deja/g++.brendan/crash13.C b/gcc/testsuite/g++.old-deja/g++.brendan/crash13.C index a292d67f235..b5287f33795 100644 --- a/gcc/testsuite/g++.old-deja/g++.brendan/crash13.C +++ b/gcc/testsuite/g++.old-deja/g++.brendan/crash13.C @@ -1,35 +1 @@ -// Build don't link: -// GROUPS passed old-abort -class gen_op -{ -public: - gen_op ( ); - gen_op (const gen_op &Op1); - ~gen_op ( ); - void operator = (const gen_op &Op1); -}; - - - - -class spin_op -{ -public: - spin_op(); - spin_op(const spin_op& SOp); - ~spin_op(); - void operator= (const spin_op& SOp); - operator gen_op(); -}; - - -spin_op Fe(); - - -gen_op Spul_U_axis() -{ - gen_op U1; - U1 = Fe(); -}; // ERROR - reaches end of non-void function - -main () {}; +int diff --git a/gcc/testsuite/g++.old-deja/g++.brendan/crash14.C b/gcc/testsuite/g++.old-deja/g++.brendan/crash14.C index d7a0de482f9..b5287f33795 100644 --- a/gcc/testsuite/g++.old-deja/g++.brendan/crash14.C +++ b/gcc/testsuite/g++.old-deja/g++.brendan/crash14.C @@ -1,23 +1 @@ -// Build don't link: -// GROUPS passed old-abort -extern "C" void printf (char *, ...); - - -class cl -{ - int i; -public: - cl(int j = 0) {i = j;} - int get_i() {return i;} - }; - -main() -{ - cl ob[3] = {1, 2, 3}; - int i; - - for(i=0; i<3; i++) - printf("%d\n", ob[i].get_i()); - - return 0; - } +int diff --git a/gcc/testsuite/g++.old-deja/g++.brendan/crash15.C b/gcc/testsuite/g++.old-deja/g++.brendan/crash15.C index a4b1ffabee3..b5287f33795 100644 --- a/gcc/testsuite/g++.old-deja/g++.brendan/crash15.C +++ b/gcc/testsuite/g++.old-deja/g++.brendan/crash15.C @@ -1,21 +1 @@ -// Build don't link: -// GROUPS passed old-abort -#include <iostream.h> - -class A { - public: - virtual ~A() {cout << "executed ~A()\n";}; -}; - -class B : public A { - public: - virtual ~B() {cout << "executed ~B()\n";}; -}; - -main() { - cout << "starting\n"; - B b; - b.~A();// ERROR - destructor - cout << "done\n"; -}; - +int diff --git a/gcc/testsuite/g++.old-deja/g++.brendan/crash19.C b/gcc/testsuite/g++.old-deja/g++.brendan/crash19.C index 8186a763d22..1738c736297 100644 --- a/gcc/testsuite/g++.old-deja/g++.brendan/crash19.C +++ b/gcc/testsuite/g++.old-deja/g++.brendan/crash19.C @@ -1,4 +1,4 @@ -// Special g++ Options: +// Special g++ Options: // Build don't link: // GROUPS passed old-abort typedef unsigned long _G_clock_t; @@ -151,8 +151,8 @@ struct __streambuf { char* _gptr; char* _egptr; char* _eback; - char* _pbase; - char* _pptr; + char* _pbase; // ERROR - inacessible + char* _pptr; // ERROR - inacessible char* _epptr; char* _base; char* _ebuf; @@ -1394,7 +1394,7 @@ class queue : public object { DESTROYER destroy_f; STRINGER string_f; int count; - swap() + int swap() { QUEUE tmp = Q; Q = Q2; diff --git a/gcc/testsuite/g++.old-deja/g++.brendan/crash29.C b/gcc/testsuite/g++.old-deja/g++.brendan/crash29.C index 855dd990be1..b5287f33795 100644 --- a/gcc/testsuite/g++.old-deja/g++.brendan/crash29.C +++ b/gcc/testsuite/g++.old-deja/g++.brendan/crash29.C @@ -1,18 +1 @@ -// Build don't link: -// GROUPS passed old-abort - -union Value -{ - Value(){} -}; - -struct GlobalAddress -{ - GlobalAddress(Value *nvar){}// ERROR - .* -};// ERROR - candidates .* - -main() -{ - new GlobalAddress(Value()); // internal error occured here// ERROR - no matching function .* - //new GlobalAddress(new Value()); // This line is correct code -} +int diff --git a/gcc/testsuite/g++.old-deja/g++.brendan/crash30.C b/gcc/testsuite/g++.old-deja/g++.brendan/crash30.C index b54fe19817e..707e89841ff 100644 --- a/gcc/testsuite/g++.old-deja/g++.brendan/crash30.C +++ b/gcc/testsuite/g++.old-deja/g++.brendan/crash30.C @@ -2,6 +2,7 @@ // GROUPS passed old-abort #include <string> +int main(void) { string a[] = {"Hello"}; diff --git a/gcc/testsuite/g++.old-deja/g++.brendan/crash33.C b/gcc/testsuite/g++.old-deja/g++.brendan/crash33.C index 061f5a91794..b5287f33795 100644 --- a/gcc/testsuite/g++.old-deja/g++.brendan/crash33.C +++ b/gcc/testsuite/g++.old-deja/g++.brendan/crash33.C @@ -1,6 +1 @@ -// Build don't link: -// GROUPS passed old-abort -extern void foo(void *); -main() { - foo((struct bar *)0); -} +int diff --git a/gcc/testsuite/g++.old-deja/g++.brendan/crash38.C b/gcc/testsuite/g++.old-deja/g++.brendan/crash38.C index d124c21e4a9..b5287f33795 100644 --- a/gcc/testsuite/g++.old-deja/g++.brendan/crash38.C +++ b/gcc/testsuite/g++.old-deja/g++.brendan/crash38.C @@ -1,42 +1 @@ -// Build don't link: -// GROUPS passed old-abort -/* - I received the following message when using g++ (version 2.3.3): - - main.cc: In method 'Implicit<implicit<INTEGER,2>,3>::Implicit()': - main.cc: Internal compiler error 241. - main.cc: Please report this to 'bug-g++@prep.ai.mit.edu' - */ - -#include <stream.h> - -class INTEGER { -int x; -public: - typedef int BASE; - INTEGER(int y) : x(y) {} - INTEGER() {} - void encode() { cout << "Integer encoder";} - int operator=(int y) { x=y; return x; } - operator int() {return x; } -}; - -template< class T, int n> class Implicit : public T { - public: - typedef typename T::BASE BASE; - Implicit(BASE value ): T(value) {}; - Implicit() : T() {}; - int myTag() { return n; } - void encode() { T::encode(); } - BASE operator=(BASE t) { return T::operator=(t); } -}; - -main() -{ - Implicit<Implicit<INTEGER, 2> , 3> y; - - y = 10; -}; - - - +int diff --git a/gcc/testsuite/g++.old-deja/g++.brendan/crash44.C b/gcc/testsuite/g++.old-deja/g++.brendan/crash44.C index dd356190913..b5287f33795 100644 --- a/gcc/testsuite/g++.old-deja/g++.brendan/crash44.C +++ b/gcc/testsuite/g++.old-deja/g++.brendan/crash44.C @@ -1,26 +1 @@ -// Build don't link: -// GROUPS passed old-abort -template <class T> class bug { - -public: - void Foo(const int = 0); - void NotRedeclared(const int); - -private: - T TheItem; -}; - -template <class T> void bug<T>::NotRedeclared(const int) -{ -} - -template <class T> void bug<T>::Foo(const int) -{ -} - -main() -{ - bug<char> InstantiatedBug; - - return 0; -} +int diff --git a/gcc/testsuite/g++.old-deja/g++.brendan/crash47.C b/gcc/testsuite/g++.old-deja/g++.brendan/crash47.C index daf2bd8b74b..b5287f33795 100644 --- a/gcc/testsuite/g++.old-deja/g++.brendan/crash47.C +++ b/gcc/testsuite/g++.old-deja/g++.brendan/crash47.C @@ -1,93 +1 @@ -// Build don't link: -// GROUPS passed old-abort -const int TRUE = 1; -const int FALSE = 0; - -class Rep { -protected: - Rep(): count(0) - { } - Rep(const Rep& other): count(0) - { } - - Rep& operator=(const Rep& other) - { /* DO NOT copy over other.count */ - return *this; } - -public: // TODO - for now - // Because it is to hard to restrict these operations to the descendants - // of Rep<REP> that we haven't named yet. So we just make them public. - void inc() - { count++; } - void dec() - { if (0 == --count) delete this; } -private: - unsigned count; -}; - -template<class REP> -class Ref { -public: - Ref(): rep(0) - { } - Ref(const Ref<REP>& other): rep(other.rep) - { if (rep) rep->inc(); } - ~Ref() - { if (rep) rep->dec(); - rep = 0; } - - Ref<REP>& operator=(const Ref<REP>& other) - { if (rep != other.rep) { - if (rep) rep->dec(); - rep = other.rep; - if (rep) rep->inc(); } - return *this; } - - bool null() const - { return 0 == rep ? TRUE: FALSE; } - bool valid() const - { return 0 != rep ? TRUE: FALSE; } - - REP* operator->() const // should be a valid() reference - { return rep; } - operator REP*() const; // should be a valid() reference - -protected: - REP *rep; - - Ref(REP *r): rep(r) - { if (rep) rep->inc(); } - - Ref<REP>& operator=(REP *r) - { if (rep != r) { - if (rep) rep->dec(); - rep = r; - if (rep) rep->inc(); } - return *this; } -}; - -template<class REP> -Ref<REP>::operator REP*() const // should be a valid() reference -{ return rep; } - -template<class REP> -inline int -operator==(const Ref<REP>& a, const Ref<REP>& b) -{ return (REP *) a == (REP *) b; } - -template<class REP> -inline int -operator!=(const Ref<REP>& a, const Ref<REP>& b) -{ return (REP *) a != (REP *) b; } - -class XRep: public Rep { -public: - int i; -}; - -main() -{ - Ref<XRep> y; - - return y != y; -} +int diff --git a/gcc/testsuite/g++.old-deja/g++.brendan/crash48.C b/gcc/testsuite/g++.old-deja/g++.brendan/crash48.C index 20882a80a53..b5287f33795 100644 --- a/gcc/testsuite/g++.old-deja/g++.brendan/crash48.C +++ b/gcc/testsuite/g++.old-deja/g++.brendan/crash48.C @@ -1,21 +1 @@ -// Build don't link: -// GROUPS passed old-abort -class internal { - int field; - int anotherfield; -}; // ERROR - candidates are - -class bug { - internal* numbers; - bug(int size); -}; // ERROR - several errors - -bug::bug(int size) -{ // ERROR - candidates - numbers = new internal(size * size);// ERROR - no match.* -} - -main() -{ - bug test;// ERROR - no match -} +int diff --git a/gcc/testsuite/g++.old-deja/g++.brendan/crash5.C b/gcc/testsuite/g++.old-deja/g++.brendan/crash5.C index d884189f6b8..b5287f33795 100644 --- a/gcc/testsuite/g++.old-deja/g++.brendan/crash5.C +++ b/gcc/testsuite/g++.old-deja/g++.brendan/crash5.C @@ -1,106 +1 @@ -// Build don't link: -// GROUPS passed old-abort -// Should have been fixed by: -// -// Sun Jun 13 12:55:22 1993 Brendan Kehoe (brendan@lisa.cygnus.com) -// -// * cp-cvt.c (build_default_binary_type_conversion): Look deeper into -// what ARG1 and ARG2 are if they're POINTER_TYPEs. - -volatile void exit(int); - -class CountableSet -{ - public: - virtual ~CountableSet() { } -}; - -template<class T> -class FixedSet : virtual public CountableSet -{ - public: - virtual int Get(int, T&) = 0; - virtual ~FixedSet() { } -}; - -class ShrinkableSet -{ - public: - virtual int Remove(int) = 0; -}; - -template<class T> -class PVSet : virtual public FixedSet<T>, virtual public ShrinkableSet -{ - public: - virtual void Append(const T&) = 0; - virtual void operator+=(const T& a) { Append(a); } - virtual ~PVSet() { } -}; - -template<class T> -class MutSet : virtual public FixedSet<T>, virtual public FixedSet<T *> -{ - protected: - typedef T *Tp; - - public: - void Append(const Tp& tp) { Append(*tp); } - - T& Access(int p) - { - Tp tp; - Get(p, tp); - return *tp; - } - virtual ~MutSet() { } -}; - -template <class T> -class SimpleSet : virtual public MutSet<T> -{ - protected: - T *array; - int size; - - virtual void Allocate(int s) - { - array = new T[s]; - } - public: - SimpleSet() - { - size = 0; - array = ((void*)0) ; // ERROR - implicit conversion - } - int Get(int p, T& t) - { - t = array[p-1]; - return 1; - } - int Get(int p, T *& t) - { - t = &array[p-1]; - return 1; - } - inline void Append(const T& a) - { - array[size-1] = a; - } - inline int Remove(int n) { return 0; } -}; - -class Dummy -{ - public: - Dummy() {} -}; - -main() -{ - SimpleSet<Dummy *> bs1; - int i, j; - Dummy foo; - - bs1+=&foo;// ERROR - no .* -} +int diff --git a/gcc/testsuite/g++.old-deja/g++.brendan/crash50.C b/gcc/testsuite/g++.old-deja/g++.brendan/crash50.C index 58695a2a330..29b55ae70ac 100644 --- a/gcc/testsuite/g++.old-deja/g++.brendan/crash50.C +++ b/gcc/testsuite/g++.old-deja/g++.brendan/crash50.C @@ -1,29 +1 @@ -// Build don't link: -// GROUPS passed old-abort -class B - { -public: - int i; - }; -int operator & (const B &s) { return ( s.i );}; - - - - - -class C - { -public: - C &operator = (const C &x) - { - return *this; - }; - }; - -C &(C::*DD)(const C &x) = &C::operator=; - -main() -{ - ⅅ - -} +int main() diff --git a/gcc/testsuite/g++.old-deja/g++.brendan/crash54.C b/gcc/testsuite/g++.old-deja/g++.brendan/crash54.C index 0b85fa1cc00..29b55ae70ac 100644 --- a/gcc/testsuite/g++.old-deja/g++.brendan/crash54.C +++ b/gcc/testsuite/g++.old-deja/g++.brendan/crash54.C @@ -1,9 +1 @@ -// Build don't link: -// GROUPS passed old-abort -main() -{ - int a[100], **p; - - p = &a[50];// ERROR - assignment to.* - -} +int main() diff --git a/gcc/testsuite/g++.old-deja/g++.brendan/crash57.C b/gcc/testsuite/g++.old-deja/g++.brendan/crash57.C index 48014c56892..29b55ae70ac 100644 --- a/gcc/testsuite/g++.old-deja/g++.brendan/crash57.C +++ b/gcc/testsuite/g++.old-deja/g++.brendan/crash57.C @@ -1,13 +1 @@ -// Build don't link: -// GROUPS passed old-abort -class foo { -private: - char buffer[1024]; -public: - foo(); -}; - -main() -{ - static foo& a = *(new foo); -} +int main() diff --git a/gcc/testsuite/g++.old-deja/g++.brendan/crash7.C b/gcc/testsuite/g++.old-deja/g++.brendan/crash7.C index c55cab97848..36745b89ae5 100644 --- a/gcc/testsuite/g++.old-deja/g++.brendan/crash7.C +++ b/gcc/testsuite/g++.old-deja/g++.brendan/crash7.C @@ -1,47 +1,2 @@ -// Build don't link: -// GROUPS passed templates -template<class T> -class Vector -{ - int sz; - T *v; -public: - Vector (int s) : sz (s) { v = new T[sz]; } - ~Vector () { delete[] v; } - T &operator[] (int i) { return v[i]; } - int size () { return sz; } -}; -template<class T>// ERROR - previous definition of T -struct Comparator -{ - typedef T T;// ERROR - use of template type T in typedef to T - static lessthan (T &a, T &b) { return a < b; } -}; - -template<class Comp> -struct Sort -{ - static void sort (Vector<Comp::T> &);// ERROR - use of bad T -}; - -template<class Comp> -void Sort<Comp>::sort (Vector<Comp::T> &v)// ERROR - use of bad T -{ - int n = v.size (); - - for (int i = 0; i < n - 1; i++) - for (int j = n - 1; i < j; j--) - if (Comp::lessthan (v[j], v[j - 1])) - { - typename Comp::T temp = v[j]; - v[j] = v[j - 1]; - v[j - 1] = temp; - } -} - -void -f (Vector<int> &vi) -{ - Sort<Comparator<int> >::sort (vi); -} + static int lessthan (T &a, T &b) { return a < b; } diff --git a/gcc/testsuite/g++.old-deja/g++.brendan/enum1.C b/gcc/testsuite/g++.old-deja/g++.brendan/enum1.C index 7ec648f4cd9..29b55ae70ac 100644 --- a/gcc/testsuite/g++.old-deja/g++.brendan/enum1.C +++ b/gcc/testsuite/g++.old-deja/g++.brendan/enum1.C @@ -1,14 +1 @@ -// Build don't link: -// GROUPS passed enums -class foo { -public: - enum bar { baz = 1, bat = 7 }; -}; - -class derv : public foo { }; - -main() -{ - foo::bar x = foo::baz; - derv::bar y = derv::bat; -} +int main() diff --git a/gcc/testsuite/g++.old-deja/g++.brendan/enum2.C b/gcc/testsuite/g++.old-deja/g++.brendan/enum2.C index 58da846f888..29b55ae70ac 100644 --- a/gcc/testsuite/g++.old-deja/g++.brendan/enum2.C +++ b/gcc/testsuite/g++.old-deja/g++.brendan/enum2.C @@ -1,19 +1 @@ -// Build don't link: -// GROUPS passed enums -class foo { -public: - enum bar { baz = 1, bat = 7 }; -}; - -class foo2 { -public: - enum bar2 { baz2 = 1, bat2 = 7 }; -}; - -class derv : public foo, public foo2 { }; - -main() -{ - foo::bar x = foo::baz; - derv::bar2 y = derv::bat2; -} +int main() diff --git a/gcc/testsuite/g++.old-deja/g++.brendan/enum5.C b/gcc/testsuite/g++.old-deja/g++.brendan/enum5.C index 2fa1ea3c9c2..29b55ae70ac 100644 --- a/gcc/testsuite/g++.old-deja/g++.brendan/enum5.C +++ b/gcc/testsuite/g++.old-deja/g++.brendan/enum5.C @@ -1,10 +1 @@ -// Build don't link: -// Special g++ Options: -pedantic-errors -// GROUPS passed enums -enum Thing { FIRST, SECOND } ; - -main() -{ - Thing x = FIRST ; - x = 27 ; // this line should be a type error.// ERROR - .* -} +int main() diff --git a/gcc/testsuite/g++.old-deja/g++.brendan/enum6.C b/gcc/testsuite/g++.old-deja/g++.brendan/enum6.C index de821487b0b..6fdcb4d14ee 100644 --- a/gcc/testsuite/g++.old-deja/g++.brendan/enum6.C +++ b/gcc/testsuite/g++.old-deja/g++.brendan/enum6.C @@ -1,16 +1,2 @@ -// Build don't link: -// GROUPS passed enums -class X { - private: - enum E1 {a1, b1}; - public: - enum E2 {a2, b2}; - }; - -void h(X* p) { - X::E2 e2; - int x2 = X::a2; - - X::E1 e1; - int x1 = X::a1; // Should be rejected, and is.// ERROR - .* - } + enum E1 {a1, b1}; // ERROR - private + int x1 = X::a1; // ERROR - within this context diff --git a/gcc/testsuite/g++.old-deja/g++.brendan/friend1.C b/gcc/testsuite/g++.old-deja/g++.brendan/friend1.C index 8d942c7e2ed..ca2ac4aff42 100644 --- a/gcc/testsuite/g++.old-deja/g++.brendan/friend1.C +++ b/gcc/testsuite/g++.old-deja/g++.brendan/friend1.C @@ -1,19 +1 @@ -// Build don't link: -// GROUPS passed friends -class A -{ -private: - A () {} - -friend struct B; -}; - -class B -{ -public: - A a; -}; - -B b; - -main () {} +int main () {} diff --git a/gcc/testsuite/g++.old-deja/g++.brendan/groff1.C b/gcc/testsuite/g++.old-deja/g++.brendan/groff1.C index 07604c9de09..f3832e07220 100644 --- a/gcc/testsuite/g++.old-deja/g++.brendan/groff1.C +++ b/gcc/testsuite/g++.old-deja/g++.brendan/groff1.C @@ -1 +1,2 @@ extern "C" void printf (const char *, ...); +int main() diff --git a/gcc/testsuite/g++.old-deja/g++.brendan/init12.C b/gcc/testsuite/g++.old-deja/g++.brendan/init12.C index f3c03e0690e..29b55ae70ac 100644 --- a/gcc/testsuite/g++.old-deja/g++.brendan/init12.C +++ b/gcc/testsuite/g++.old-deja/g++.brendan/init12.C @@ -1,9 +1 @@ -// Build don't link: -// GROUPS passed array-bindings -char * bob(); - -main() -{ - char a[1][2]; - a[0] = bob();// ERROR - .* -} +int main() diff --git a/gcc/testsuite/g++.old-deja/g++.brendan/init3.C b/gcc/testsuite/g++.old-deja/g++.brendan/init3.C index 91b2f7cbeb6..29b55ae70ac 100644 --- a/gcc/testsuite/g++.old-deja/g++.brendan/init3.C +++ b/gcc/testsuite/g++.old-deja/g++.brendan/init3.C @@ -1,38 +1 @@ -// GROUPS passed initialization -// p2766: Make sure that members are initialized in order of declaration -// in the class, not in order of specification in the mem-initializer list. - -extern "C" void printf (char *, ...); -extern "C" void exit (int); - -int count = 0; - -void die () { printf ("FAIL\n"); exit (1); } - -class bar1 { -public: - bar1 (int) { if (count != 0) die (); count = 1; } -}; - -class bar2 -{ -public: - bar2 (int) { if (count != 1) die (); count = 2; } -}; - -class foo -{ -public: - bar1 a; - bar2 b; - foo (int, int); -}; - -// bar1 should get built before bar2 -foo::foo (int x, int y) : b(x), a(y) {} - -main() -{ - foo f (1, 2); - printf ("PASS\n"); -} +int main() diff --git a/gcc/testsuite/g++.old-deja/g++.brendan/misc14.C b/gcc/testsuite/g++.old-deja/g++.brendan/misc14.C index 7d57e30147d..237c8ce1817 100644 --- a/gcc/testsuite/g++.old-deja/g++.brendan/misc14.C +++ b/gcc/testsuite/g++.old-deja/g++.brendan/misc14.C @@ -1,12 +1 @@ -// Build don't link: -// GROUPS passed miscellaneous-bugs -class X { -public: - enum e { - New,// ERROR - conflicts with other.* - }; // ERROR - comma - - static int New(int);// ERROR - declaration.* -}; - -main() {} +int main() {} diff --git a/gcc/testsuite/g++.old-deja/g++.brendan/misc7.C b/gcc/testsuite/g++.old-deja/g++.brendan/misc7.C index 078dbc9c858..29b55ae70ac 100644 --- a/gcc/testsuite/g++.old-deja/g++.brendan/misc7.C +++ b/gcc/testsuite/g++.old-deja/g++.brendan/misc7.C @@ -1,15 +1 @@ -// GROUPS passed miscellaneous -extern "C" void printf (char *, ...); - -main() -{ - int i = 0; - // Make sure build_unary_op correctly computes this. - int *pi = &(++i); - *pi = 4; - - if (i != 4) - printf ("FAIL\n"); - else - printf ("PASS\n"); -} +int main() diff --git a/gcc/testsuite/g++.old-deja/g++.brendan/misc8.C b/gcc/testsuite/g++.old-deja/g++.brendan/misc8.C index 7efad41d896..29b55ae70ac 100644 --- a/gcc/testsuite/g++.old-deja/g++.brendan/misc8.C +++ b/gcc/testsuite/g++.old-deja/g++.brendan/misc8.C @@ -1,18 +1 @@ -// Build don't link: -// GROUPS passed miscellaneous -// used to say invalid lvalue in `&\' -class foo { - int a; - public: - foo(int a); -}; - -foo::foo(int a) -{ - foo::a=a; -} - -main() -{ -foo obj(4); -} +int main() diff --git a/gcc/testsuite/g++.old-deja/g++.brendan/nest10.C b/gcc/testsuite/g++.old-deja/g++.brendan/nest10.C index 751440d1947..fca7aa3a92f 100644 --- a/gcc/testsuite/g++.old-deja/g++.brendan/nest10.C +++ b/gcc/testsuite/g++.old-deja/g++.brendan/nest10.C @@ -1,30 +1 @@ -// Build don't link: -// GROUPS passed nested-classes -class A - { - public: - class B - { - public: - int f (); - void g (int); - private: - int b; - }; - }; - -int A::B::f () - { - int val=b; - return val; - } - -void A::B::g (int val) - { - b = val; - } - - -main () - { - } +int main () diff --git a/gcc/testsuite/g++.old-deja/g++.brendan/nest21.C b/gcc/testsuite/g++.old-deja/g++.brendan/nest21.C index c4eb0ee78ab..29b55ae70ac 100644 --- a/gcc/testsuite/g++.old-deja/g++.brendan/nest21.C +++ b/gcc/testsuite/g++.old-deja/g++.brendan/nest21.C @@ -1,95 +1 @@ -// GROUPS passed nested-classes -#include <iostream.h> -#include <stdio.h> - -static char output[1024]; - -class BDDRetrace { -public: - class Dump { - public: - virtual Dump& operator<<(char c) = 0; - virtual Dump& operator<<(int i) = 0; - virtual Dump& operator<<(double r) = 0; - }; - - class Dump1: public Dump { - public: - Dump& operator<<(char c); - Dump& operator<<(int i); - Dump& operator<<(double r); - }; -}; - -class Dump2: public BDDRetrace::Dump { -public: - BDDRetrace::Dump& operator<<(char c); - BDDRetrace::Dump& operator<<(int i); - BDDRetrace::Dump& operator<<(double r); -}; - -BDDRetrace::Dump& -BDDRetrace::Dump1::operator<<(char c) -{ char tempout[1024]; - sprintf (tempout, "%s%s%c", output, "1-", c); - strcpy (output, tempout); - return *this; -} - -BDDRetrace::Dump& -BDDRetrace::Dump1::operator<<(int i) -{ char tempout[1024]; - sprintf (tempout, "%s%s%d", output, "1-", i); - strcpy (output, tempout); - return *this; } - -BDDRetrace::Dump& -BDDRetrace::Dump1::operator<<(double r) -{ char tempout[1024]; - sprintf (tempout, "%s%s%1.0f", output, "1-", r); - strcpy (output, tempout); - return *this; } - -BDDRetrace::Dump& -Dump2::operator<<(char c) -{ char tempout[1024]; - sprintf (tempout, "%s%s%c", output, "2-", c); - strcpy (output, tempout); - return *this; } - -BDDRetrace::Dump& -Dump2::operator<<(int i) -{ char tempout[1024]; - sprintf (tempout, "%s%s%d", output, "2-", i); - strcpy (output, tempout); - return *this; } - -BDDRetrace::Dump& -Dump2::operator<<(double r) -{ char tempout[1024]; - sprintf (tempout, "%s%s%1.0f", output, "2-", r); - strcpy (output, tempout); - return *this; } - -main() -{ - BDDRetrace::Dump1 d1; - Dump2 d2; - - sprintf (output, " "); - - d1 << 'a'; - d1 << 1; - d1 << 1.0; - - d2 << 'a'; - d2 << 1; - d2 << 1.0; - - if (strcmp (output, " 1-a1-11-12-a2-12-1") == 0) - printf ("PASS\n"); - else - printf ("FAIL\n"); - - return 0; -} +int main() diff --git a/gcc/testsuite/g++.old-deja/g++.brendan/nest3.C b/gcc/testsuite/g++.old-deja/g++.brendan/nest3.C index 16e7df88b45..8b8d58de0ed 100644 --- a/gcc/testsuite/g++.old-deja/g++.brendan/nest3.C +++ b/gcc/testsuite/g++.old-deja/g++.brendan/nest3.C @@ -1,12 +1 @@ -// Build don't link: -// GROUPS passed nested-classes -class X { -public: - struct M2 { int m; }; - M2 g(int); -}; - - -X::M2 X::g(int i) { X::M2 m2; return m2; } - -main() { } +int main() { } diff --git a/gcc/testsuite/g++.old-deja/g++.brendan/new-array.C b/gcc/testsuite/g++.old-deja/g++.brendan/new-array.C index 5341010822c..765014bc66d 100644 --- a/gcc/testsuite/g++.old-deja/g++.brendan/new-array.C +++ b/gcc/testsuite/g++.old-deja/g++.brendan/new-array.C @@ -1,18 +1 @@ -// Build don't link: -// GROUPS passed operator-new -typedef struct { - int a; -} AStruct; - -void MakeBug() { - AStruct *job; - - // This used to crash, it should now give error(s). - job = new AStruct[];// ERROR - .* - - job = new AStruct; -} - -main () { - MakeBug(); -} +int main () { diff --git a/gcc/testsuite/g++.old-deja/g++.brendan/operators1.C b/gcc/testsuite/g++.old-deja/g++.brendan/operators1.C index 6146eb401a0..b3b753c1a91 100644 --- a/gcc/testsuite/g++.old-deja/g++.brendan/operators1.C +++ b/gcc/testsuite/g++.old-deja/g++.brendan/operators1.C @@ -1,14 +1 @@ -// Build don't link: -// GROUPS passed operators -struct A { - int x; -}; - -int operator()(A x,float y) { // MUST be a member function// ERROR - .* - return 1; -} - -main() { - A x; - x(1.0); // ERROR - no match for call -} +int main() { diff --git a/gcc/testsuite/g++.old-deja/g++.brendan/overload1.C b/gcc/testsuite/g++.old-deja/g++.brendan/overload1.C index 5658fdd8f9b..fca7aa3a92f 100644 --- a/gcc/testsuite/g++.old-deja/g++.brendan/overload1.C +++ b/gcc/testsuite/g++.old-deja/g++.brendan/overload1.C @@ -1,21 +1 @@ -// Build don't link: -// GROUPS passed overloading -class Foo -{ -public: - int f (void); -}; - -class Bar : public Foo -{ -public: - int f (int); // ERROR - candidates are -}; - -main () -{ - Bar b; - - b.f ();// ERROR - - b.f (10); -} +int main () diff --git a/gcc/testsuite/g++.old-deja/g++.brendan/overload7.C b/gcc/testsuite/g++.old-deja/g++.brendan/overload7.C index 0c39e0d8c21..29b55ae70ac 100644 --- a/gcc/testsuite/g++.old-deja/g++.brendan/overload7.C +++ b/gcc/testsuite/g++.old-deja/g++.brendan/overload7.C @@ -1,41 +1 @@ -// GROUPS passed overloading -extern "C" void printf (char *, ...); - -struct NoName { - - int first; - int second; -}; - -class Casted { - - public: - - NoName x; - double y; - - Casted ( int _x , double _y ): y(_y) - { - x.first = _x; - x.second = _x*2; - } - - operator NoName() const { return x; } - operator double() const { return y; } -}; - -main() -{ - Casted c(10,12.34); - - NoName x; - double y; - - x = c; - y = c; - - if (x.first == 10 && x.second == 20 && y == 12.34) - printf ("PASS\n"); - else - printf ("FAIL\n"); -} +int main() diff --git a/gcc/testsuite/g++.old-deja/g++.brendan/overload8.C b/gcc/testsuite/g++.old-deja/g++.brendan/overload8.C index 6057ebe7086..bd828ec79cb 100644 --- a/gcc/testsuite/g++.old-deja/g++.brendan/overload8.C +++ b/gcc/testsuite/g++.old-deja/g++.brendan/overload8.C @@ -1,9 +1 @@ -// Build don't link: -// GROUPS passed overloading -typedef struct{double re,im;} complex; -class Complex{public:double re,im; - inline void operator=(Complex&X){re=X.re; im=X.im;};}; -void zxcvbnm(int n,...){n=1;} -main(){complex c; Complex C; -zxcvbnm(1,c); -zxcvbnm(1,C);} +int main(){complex c; Complex C; diff --git a/gcc/testsuite/g++.old-deja/g++.brendan/overload9.C b/gcc/testsuite/g++.old-deja/g++.brendan/overload9.C index 2d5dfa3553d..29b55ae70ac 100644 --- a/gcc/testsuite/g++.old-deja/g++.brendan/overload9.C +++ b/gcc/testsuite/g++.old-deja/g++.brendan/overload9.C @@ -1,20 +1 @@ -// Build don't link: -// GROUPS passed overloading -class CLogger -{ -public: - void operator() (int,const char *) {}; // ERROR - candidates - void operator() (int,const char *, ...) {}; // ERROR - candidates -} Log; - -class CGLogger : public CLogger -{ -} GLog; - -main() -{ - Log(1,"Test");// ERROR - call of.* - Log(1,"Test %d",3); - GLog(1,"Test");// ERROR - call of.* - GLog(1,"Test %d",3); -} +int main() diff --git a/gcc/testsuite/g++.old-deja/g++.brendan/parse1.C b/gcc/testsuite/g++.old-deja/g++.brendan/parse1.C index 76bfb0ea378..29b55ae70ac 100644 --- a/gcc/testsuite/g++.old-deja/g++.brendan/parse1.C +++ b/gcc/testsuite/g++.old-deja/g++.brendan/parse1.C @@ -1,17 +1 @@ -// Build don't link: -// GROUPS passed parsing -class Try { -private: - char s; -public: - // an escaped double-quote should not call consume_string inside - // reinit_parse_for_block - void mf() { s='\"'; } -}; - -main() -{ - Try x; - x.mf(); -} - +int main() diff --git a/gcc/testsuite/g++.old-deja/g++.brendan/parse3.C b/gcc/testsuite/g++.old-deja/g++.brendan/parse3.C index c346a289f9a..8be64a39b68 100644 --- a/gcc/testsuite/g++.old-deja/g++.brendan/parse3.C +++ b/gcc/testsuite/g++.old-deja/g++.brendan/parse3.C @@ -18,5 +18,5 @@ A A::operator+(const A in) if (high==0) return A(); // this works else - return (A()); // this works not !! -> why ?? // ERROR - -} // ERROR - + return (A()); // this works not // gets bogus error - XFAIL *-*-* +} // gets bogus error - XFAIL *-*-* diff --git a/gcc/testsuite/g++.old-deja/g++.brendan/parse4.C b/gcc/testsuite/g++.old-deja/g++.brendan/parse4.C index d60cefeb3e5..6526c605951 100644 --- a/gcc/testsuite/g++.old-deja/g++.brendan/parse4.C +++ b/gcc/testsuite/g++.old-deja/g++.brendan/parse4.C @@ -14,7 +14,7 @@ public: int g() { return 0; } // gets bogus error - referenced below XFAIL *-*-* -main() +int main() { int try1; B( try1 ).f(); // no syntax error diff --git a/gcc/testsuite/g++.old-deja/g++.brendan/parse5.C b/gcc/testsuite/g++.old-deja/g++.brendan/parse5.C index 3b311e4b06e..81a5fe649b1 100644 --- a/gcc/testsuite/g++.old-deja/g++.brendan/parse5.C +++ b/gcc/testsuite/g++.old-deja/g++.brendan/parse5.C @@ -21,5 +21,5 @@ public: int main() { unsigned char b[3]; - buf<3> b2(ptr8(&b[0],3)); // ERROR - + buf<3> b2(ptr8(&b[0],3)); // gets bogus error - XFAIL *-*-* } diff --git a/gcc/testsuite/g++.old-deja/g++.brendan/parse6.C b/gcc/testsuite/g++.old-deja/g++.brendan/parse6.C index 5e27c58836f..d5ece069103 100644 --- a/gcc/testsuite/g++.old-deja/g++.brendan/parse6.C +++ b/gcc/testsuite/g++.old-deja/g++.brendan/parse6.C @@ -7,7 +7,7 @@ class A { }; -main() { +int main() { A a = a; - A b(b); // ERROR - + A b(b); // gets bogus error - XFAIL *-*-* } diff --git a/gcc/testsuite/g++.old-deja/g++.brendan/prepost1.C b/gcc/testsuite/g++.old-deja/g++.brendan/prepost1.C index ba1a2084efe..29b55ae70ac 100644 --- a/gcc/testsuite/g++.old-deja/g++.brendan/prepost1.C +++ b/gcc/testsuite/g++.old-deja/g++.brendan/prepost1.C @@ -1,15 +1 @@ -// Build don't link: -// GROUPS passed prefix-postfix -class foo { -public: - operator ++ (); // ERROR - no type or storage class -}; - -main() -{ - foo x; - - // This should fall back to calling operator++(), and be an error with - // the -pedantic flag. - x++;// ERROR - -} +int main() diff --git a/gcc/testsuite/g++.old-deja/g++.brendan/ptolemy2.C b/gcc/testsuite/g++.old-deja/g++.brendan/ptolemy2.C index ca9c21c2814..c141c7c16da 100644 --- a/gcc/testsuite/g++.old-deja/g++.brendan/ptolemy2.C +++ b/gcc/testsuite/g++.old-deja/g++.brendan/ptolemy2.C @@ -1,69 +1 @@ -// GROUPS passed ptolemy-bugs -#include <iostream.h> - -class PTcl { -public: - int dispatcher(int which,int argc,char** argv); - // fns in the table - int one(int argc, char** argv); - int two(int argc, char** argv); - int three(int argc, char** argv); -}; - -// An InterpFuncP is a pointer to an PTcl function that takes an argc-argv -// argument list and returns TCL_OK or TCL_ERROR. - -typedef int (PTcl::*InterpFuncP)(int,char**); - -struct InterpTableEntry { - char* name; - InterpFuncP func; -}; - -// Here is the function table and dispatcher function. -// These macros define entries for the table - -#define quote(x) #x -#define ENTRY(verb) { quote(verb), &PTcl::verb } - -static InterpTableEntry funcTable[] = { - ENTRY(one), - ENTRY(two), - ENTRY(three), - {0, 0} -}; - -int PTcl::dispatcher(int which, int argc, char** argv) { - return (this->*(funcTable[which].func))(argc, argv); -} - -void printargs(char** argv) { -// while (*argv) { -// cout << " " << *argv++; -// } -// cout << "\n"; -} - -int PTcl::one(int, char** argv) { - cout << "FAIL\n"; - printargs(argv); - return 0; -} - -int PTcl::two(int, char** argv) { - cout << "PASS\n"; - printargs(argv); - return 0; -} - -int PTcl::three(int, char** argv) { - cout << "FAIL\n"; - printargs(argv); - return 0; -} - -main (int argc, char** argv) { - PTcl obj; - obj.dispatcher(1,argc,argv); - return 0; -} +int main (int argc, char** argv) { diff --git a/gcc/testsuite/g++.old-deja/g++.brendan/recurse.C b/gcc/testsuite/g++.old-deja/g++.brendan/recurse.C index 93baa4490b4..29b55ae70ac 100644 --- a/gcc/testsuite/g++.old-deja/g++.brendan/recurse.C +++ b/gcc/testsuite/g++.old-deja/g++.brendan/recurse.C @@ -1,80 +1 @@ -// Build don't link: -// GROUPS passed recursive-aborts -// types -typedef unsigned int DBflag; // for storing user flag value -typedef unsigned long DBoffset; // 32-bit unsigned integer -typedef DBoffset DBsize; // type for storing sizes of objects -typedef unsigned char DBbyte; // 8-bit unsigned char - -class DBlink -{ -protected: - DBbyte link[4]; // hold link in portable MSB first format -public: - DBlink(DBoffset = 0, DBflag = 0); - DBlink &operator=(const DBlink &); - DBlink &operator=(DBoffset); - operator DBoffset(); - operator const DBbyte *() { return link; } - void set_flag() { link[0] |= 0x80; } - void reset_flag() { link[0] &= 0x7f; } - int test_flag() const { return (link[0] & 0x80) != 0; } -}; - -typedef DBlink DBsizerec; // hold data record size in portable format - -// constants -const DBoffset DB_NULL = 0; - -class DBlinkrec -{ -protected: - // offsets are stored with MSB in link[0] - DBlink l; // offset into link file of right child - MSB = red bit - DBlink r; // offset into link file of left child - MSB = delete - DBlink d; // offset into parallel data file - MSB = user flag -public: - DBlinkrec():l(DB_NULL), r(DB_NULL), d(DB_NULL) {} - void make_red() // set link to red - { l.set_flag(); } - void make_black() // set link to black - { l.reset_flag(); } - int is_red() const // indicates whether this is a red link - { return l.test_flag(); } - void set_discard() // set discard flag - { r.set_flag(); } - void reset_discard() // reset discard flag - { r.reset_flag(); } - int is_discarded() const // check discard flag - { return r.test_flag(); } - void set_flag() // set user flag - { d.set_flag(); } - void reset_flag() // reset user flag - { d.reset_flag(); } - int is_flag() const // check user flag - { return d.test_flag(); } - - friend class DataBase; -}; - -class DBpathrec : public DBlinkrec -{ - DBoffset offset; // offset of link record in LNK file -public: - DBpathrec():offset(DB_NULL) { } - DBpathrec(DBoffset off, const DBlinkrec &lr):offset(off), DBlinkrec(lr) {} - operator DBoffset() { return offset; } - DBpathrec &operator=(DBoffset off) { offset = off; return *this; } - DBpathrec &operator=(const DBpathrec &pr) - { offset = pr.offset; (DBlinkrec)*this = (DBlinkrec)pr; return *this; } - - friend class DataBase; -}; - -main() -{ - DBpathrec a(), b(); - - a = b;// ERROR - non-lvalue in assignment.* -} - +int main() diff --git a/gcc/testsuite/g++.old-deja/g++.brendan/scope2.C b/gcc/testsuite/g++.old-deja/g++.brendan/scope2.C index 7085716be73..29b55ae70ac 100644 --- a/gcc/testsuite/g++.old-deja/g++.brendan/scope2.C +++ b/gcc/testsuite/g++.old-deja/g++.brendan/scope2.C @@ -1,29 +1 @@ -// Build don't link: -// GROUPS passed scoping -class A -{ - public: - A() {} - ~A() {} - virtual void f() {} -}; - -class B : public A -{ - public: - B() {} - ~B() {} - virtual void f() {} -}; - - -B GLOBAL_B; - -B& foo() {return GLOBAL_B;} - -main() -{ - // build_scoped_method_call and build_scoped_ref should know how - // to deal with a reference for this - foo().A::f(); -} +int main() diff --git a/gcc/testsuite/g++.old-deja/g++.brendan/static2.C b/gcc/testsuite/g++.old-deja/g++.brendan/static2.C index 1e050e2cf6f..29b55ae70ac 100644 --- a/gcc/testsuite/g++.old-deja/g++.brendan/static2.C +++ b/gcc/testsuite/g++.old-deja/g++.brendan/static2.C @@ -1,19 +1 @@ -// Build don't link: -// GROUPS passed static -class A -{ - public: - void member(void) - { - } - - static void staticMember() - { - member (); // illegal, no object for calling non-static method// ERROR - .* - } -}; - -main() -{ - A::staticMember(); -} +int main() diff --git a/gcc/testsuite/g++.old-deja/g++.brendan/template11.C b/gcc/testsuite/g++.old-deja/g++.brendan/template11.C index 55fa2b20025..29b55ae70ac 100644 --- a/gcc/testsuite/g++.old-deja/g++.brendan/template11.C +++ b/gcc/testsuite/g++.old-deja/g++.brendan/template11.C @@ -1,47 +1 @@ -// Build don't link: -// GROUPS passed templates -template <class Called> -class aCallback -{ -public: - aCallback(Called& obj, int (Called::*met)()); - - int callback(); - -protected: - -private: - // the object to call - Called& object; - - // the method to apply - int (Called::*method)(); - -}; - -template <class Called> -aCallback<Called>::aCallback(Called& obj, - int (Called::*met)()) : -object(obj), -method(met) -{}; - -template <class Called> -int aCallback<Called>::callback() -{ - return (object.*method)(); -} - -struct myStruct -{ - int action() {return 24;}; -}; - -main() -{ - myStruct toto; - - aCallback<myStruct> cb(toto, &myStruct::action); - - return cb.callback(); -} +int main() diff --git a/gcc/testsuite/g++.old-deja/g++.brendan/template2.C b/gcc/testsuite/g++.old-deja/g++.brendan/template2.C index 07e2e66a7c0..765014bc66d 100644 --- a/gcc/testsuite/g++.old-deja/g++.brendan/template2.C +++ b/gcc/testsuite/g++.old-deja/g++.brendan/template2.C @@ -1,14 +1 @@ -// Build don't link: -// GROUPS passed templates -template <class Q> -class Conc { -public: - static int body(); -}; - -template <class Q> -int Conc<Q>::body() {return 0;} - -main () { - Conc<int> s2; -} +int main () { diff --git a/gcc/testsuite/g++.old-deja/g++.brendan/template20.C b/gcc/testsuite/g++.old-deja/g++.brendan/template20.C index 7f5c4acd467..29b55ae70ac 100644 --- a/gcc/testsuite/g++.old-deja/g++.brendan/template20.C +++ b/gcc/testsuite/g++.old-deja/g++.brendan/template20.C @@ -1,21 +1 @@ -// Build don't link: -// GROUPS passed templates -template <class A, class B> class Map; - -class Foo -{ -public: - static Map<int,int> bar; -}; - -template <class A, class B> -class Map -{ -public : - int find(); -}; - -main() -{ - int z = Foo::bar.find(); -} +int main() diff --git a/gcc/testsuite/g++.old-deja/g++.brendan/template22.C b/gcc/testsuite/g++.old-deja/g++.brendan/template22.C index a977e2ffacf..fca7aa3a92f 100644 --- a/gcc/testsuite/g++.old-deja/g++.brendan/template22.C +++ b/gcc/testsuite/g++.old-deja/g++.brendan/template22.C @@ -1,22 +1 @@ -// GROUPS passed templates -extern "C" int printf (const char *, ...); - -template <class T> -class Foo -{ -public: - void func (int const& i); -}; - -template <class T> -void Foo<T>:: -func (int const& i) -{} - - -main () -{ - Foo<int const> foo; - printf ("PASS\n"); - return 0; -} +int main () diff --git a/gcc/testsuite/g++.old-deja/g++.brendan/template24.C b/gcc/testsuite/g++.old-deja/g++.brendan/template24.C index 7d677023282..fca7aa3a92f 100644 --- a/gcc/testsuite/g++.old-deja/g++.brendan/template24.C +++ b/gcc/testsuite/g++.old-deja/g++.brendan/template24.C @@ -1,20 +1 @@ -// GROUPS passed templates -extern "C" void printf (char *, ...); - -template <class F> -class Temp -{ - F func_; -public: - Temp (F f) :func_(f) {} -}; - -int func (int h = 1, int z = 2) { return h+z; } - -main () -{ - Temp<int(*)(int, int)> temp (func); - - printf ("PASS\n"); - return 0; -} +int main () diff --git a/gcc/testsuite/g++.old-deja/g++.brendan/template28.C b/gcc/testsuite/g++.old-deja/g++.brendan/template28.C index 3ae4caf4638..c0c35bdbfa5 100644 --- a/gcc/testsuite/g++.old-deja/g++.brendan/template28.C +++ b/gcc/testsuite/g++.old-deja/g++.brendan/template28.C @@ -1,13 +1 @@ -// Build don't link: -// GROUPS passed templates -class X { - const char *fptr; -public: - X(const char *ptr) { fptr = ptr; } - operator const char*() { return fptr; } -}; - -main(){ - X x1("1234"); - X x2(x1+1); -} +int main(){ diff --git a/gcc/testsuite/g++.old-deja/g++.brendan/template29.C b/gcc/testsuite/g++.old-deja/g++.brendan/template29.C index fa81995ed74..a5239f54404 100644 --- a/gcc/testsuite/g++.old-deja/g++.brendan/template29.C +++ b/gcc/testsuite/g++.old-deja/g++.brendan/template29.C @@ -1,12 +1 @@ -// Build don't link: -// GROUPS passed templates - template <class ElementType> class A - { public: - A(ElementType) {} - ElementType get() const ; - }; - - template <class ElementType> ElementType A<ElementType>::get() const - { return ElementType(0); } - - main() { const A<short> a(3); } +int main() { const A<short> a(3); } diff --git a/gcc/testsuite/g++.old-deja/g++.brendan/template8.C b/gcc/testsuite/g++.old-deja/g++.brendan/template8.C index 0a24617239f..c0c35bdbfa5 100644 --- a/gcc/testsuite/g++.old-deja/g++.brendan/template8.C +++ b/gcc/testsuite/g++.old-deja/g++.brendan/template8.C @@ -1,20 +1 @@ -// Build don't link: -// GROUPS passed templates -#include <stdio.h> - -// make sure we accept unions for templates -template<int n> -union Double_alignt{ - double for_alignt; - char array[n]; - -}; - -main(){ - - - Double_alignt<20000> heap; - - printf(" &heap.array[0] = %d, &heap.for_alignt = %d\n", &heap.array[0], &heap.for_alignt); - -} +int main(){ diff --git a/gcc/testsuite/g++.old-deja/g++.brendan/temporary1.C b/gcc/testsuite/g++.old-deja/g++.brendan/temporary1.C index 5258edf36a5..fca7aa3a92f 100644 --- a/gcc/testsuite/g++.old-deja/g++.brendan/temporary1.C +++ b/gcc/testsuite/g++.old-deja/g++.brendan/temporary1.C @@ -1,13 +1 @@ -// Build don't link: -// GROUPS passed temporaries -#include <stdio.h> - -main () -{ - int a = 2; - - if (----a == 0) - printf ("a = 0\n"); - - printf ("a = %d\n", a); -} +int main () diff --git a/gcc/testsuite/g++.old-deja/g++.brendan/visibility1.C b/gcc/testsuite/g++.old-deja/g++.brendan/visibility1.C index 7d11f875716..cd87ccb98b7 100644 --- a/gcc/testsuite/g++.old-deja/g++.brendan/visibility1.C +++ b/gcc/testsuite/g++.old-deja/g++.brendan/visibility1.C @@ -1,16 +1 @@ -// Build don't link: -// GROUPS passed visibility -class foo { -protected: - int i; -}; - -class bar : public foo { -public: - friend void baz (foo *); -}; - -void baz (foo *f) -{ - f->i = 1; // error: i is protected// ERROR - .* -} + int i; // ERROR - protected diff --git a/gcc/testsuite/g++.old-deja/g++.brendan/visibility4.C b/gcc/testsuite/g++.old-deja/g++.brendan/visibility4.C index b9de78f1881..b1f443948ae 100644 --- a/gcc/testsuite/g++.old-deja/g++.brendan/visibility4.C +++ b/gcc/testsuite/g++.old-deja/g++.brendan/visibility4.C @@ -1,14 +1,2 @@ -// Build don't link: -// Special g++ Options: -w -// GROUPS passed visibility -template <class T> -class Feld { -public: - Feld(const Feld&) {} -}; - -class Polynom : private Feld<double> { -friend Polynom f(const Polynom&); -}; - -Polynom f(const Polynom& p) { return p; } + Polynom(); + friend Polynom f(const Polynom&); diff --git a/gcc/testsuite/g++.old-deja/g++.brendan/visibility6.C b/gcc/testsuite/g++.old-deja/g++.brendan/visibility6.C index 5ca62c0c6a7..cf15fdf3cce 100644 --- a/gcc/testsuite/g++.old-deja/g++.brendan/visibility6.C +++ b/gcc/testsuite/g++.old-deja/g++.brendan/visibility6.C @@ -1,17 +1 @@ -// Build don't link: -// GROUPS passed visibility -class bottom -{ -public: - int b; -}; -class middle : private bottom -{ -public: - void foo () { b; } -}; -class top : public middle -{ -public: - void bar () { b; }// ERROR - .* -}; + int b; // ERROR - private diff --git a/gcc/testsuite/g++.old-deja/g++.brendan/visibility8.C b/gcc/testsuite/g++.old-deja/g++.brendan/visibility8.C index a3bb856d1ad..203b1f61be4 100644 --- a/gcc/testsuite/g++.old-deja/g++.brendan/visibility8.C +++ b/gcc/testsuite/g++.old-deja/g++.brendan/visibility8.C @@ -1,15 +1 @@ -// Build don't link: -// GROUPS passed visibility -// Make sure private inheritance affects the visibility of -// static members used in an inherited context. -class foo -{ -public: - static int y; -}; -class foo1 : private foo -{ }; -class foo2 : public foo1 -{ public: - void bar () { y; }// ERROR - .* -}; + static int y; // ERROR - private diff --git a/gcc/testsuite/g++.old-deja/g++.bugs/900121_01.C b/gcc/testsuite/g++.old-deja/g++.bugs/900121_01.C index 99ab8f6cbcf..4582067c0ad 100644 --- a/gcc/testsuite/g++.old-deja/g++.bugs/900121_01.C +++ b/gcc/testsuite/g++.old-deja/g++.bugs/900121_01.C @@ -1,16 +1 @@ -// g++ 1.36.1 bug 900121_01 - -// The following file causes g++ 1.36.1 (and 1.36.2) to abort. - -// Cfront 2.0 passes this test. - -// keywords: abort, incomplete types, reference types, formal parameters - -struct s0; - -void function (struct s0 &arg1, struct s0 &arg2) -{ - arg1 = arg2; // ERROR - causes abort -} - -int main () { return 0; } +struct s0; // ERROR - forward declaration diff --git a/gcc/testsuite/g++.old-deja/g++.bugs/900213_03.C b/gcc/testsuite/g++.old-deja/g++.bugs/900213_03.C index d25a8b2f7f7..6a12cbe96c4 100644 --- a/gcc/testsuite/g++.old-deja/g++.bugs/900213_03.C +++ b/gcc/testsuite/g++.old-deja/g++.bugs/900213_03.C @@ -1,28 +1 @@ -// g++ 1.36.1 bug 900213_03 - -// g++ fails to detect an error when the address of a "bound" function is -// assigned to a pointer-to-member-function variable. - -// It does however correctly detect a similar errors for data-members. - -// keywords: bound function, operator&, member pointers -// Build don't link: - -struct struct0 { - int data_member; - int function_member (); -}; - -int i; -int struct0::*dmp; -int (struct0::*fmp) (); - -struct0 *ptr; - -void global_function_0 () -{ - fmp = &ptr->function_member; // ERROR - missed by g++, warned by cfront, XFAIL *-*-* - //dmp = &ptr->data_member; // caught by g++, missed by cfront -} - -int main () { return 0; } + fmp = &ptr->function_member; // ERROR - diff --git a/gcc/testsuite/g++.old-deja/g++.bugs/900214_01.C b/gcc/testsuite/g++.old-deja/g++.bugs/900214_01.C index 3aac764f86e..8fe79b53514 100644 --- a/gcc/testsuite/g++.old-deja/g++.bugs/900214_01.C +++ b/gcc/testsuite/g++.old-deja/g++.bugs/900214_01.C @@ -1,22 +1 @@ -// g++ 1.36.1 bug 900214_01 - -// g++ allows function members of incomplete types to be declared to be -// friends of other types. - -// Cfront 2.0 passes this test. - -// keywords: friends, incomplete types, function members - -struct A; - -struct B { - friend void A::foo(); // ERROR - type A is incomplete -}; - -void A::foo(); /* ERROR - also illegal */ - -struct A { - void foo() {} -}; - -int main () { return 0; } +struct A; // ERROR - forward declaration diff --git a/gcc/testsuite/g++.old-deja/g++.bugs/900215_02.C b/gcc/testsuite/g++.old-deja/g++.bugs/900215_02.C index fb08df3bd33..1616b69c11f 100644 --- a/gcc/testsuite/g++.old-deja/g++.bugs/900215_02.C +++ b/gcc/testsuite/g++.old-deja/g++.bugs/900215_02.C @@ -1,47 +1 @@ -// g++ 1.36.1 bug 900215_02 - -// g++ allows global objects (which happen to be pointers to members of some -// class X) to be dereferenced without prefix object specifications within -// member functions of class X. - -// In effect, g++ treats any dereference of a pointer-to-member which appears -// within the context of a member function (and which is not preceeded by -// either ->* or .*) as if it had been implicitly prefixed with this->*. - -// The 2.0 Reference Manual only provides that such implicit prefixing -// takes place for *members* of the containing class, and *not* for -// global objects that happen to have certain types (i.e. pointer-to-member -// of the containing class). - -// Also, cfront 2.0 provides implicit this-> prefixes *only* for *members* -// of the containing class. - -// Cfront 2.0 passes this test. - -// keywords: member pointers, this, dereference, members - -struct struct0 { - int data_member; - void function_member (); -}; - -int struct0::*dmp; -int (struct0::*fmp) (); -int i; - -struct struct1 { - int data_member; - - void function_member (); -}; - -void struct0::function_member () -{ - i = (this->*fmp) (); // perfectly legal - for both cfront and g++ - i = this->*dmp; // perfectly legal - for both cfront and g++ - - i = (*fmp) (); // ERROR - - i = *dmp; // ERROR - , XFAIL *-*-* -} - -int main () { return 0; } + i = *dmp; // ERROR - diff --git a/gcc/testsuite/g++.old-deja/g++.bugs/900321_01.C b/gcc/testsuite/g++.old-deja/g++.bugs/900321_01.C index 56a333f532b..08771d07e74 100644 --- a/gcc/testsuite/g++.old-deja/g++.bugs/900321_01.C +++ b/gcc/testsuite/g++.old-deja/g++.bugs/900321_01.C @@ -1,29 +1,2 @@ -// g++ 1.37.1 bug 900321_01 - -// cfront flags ERRORs on each of the lines indicated below. g++ does not -// flag either ERRORs or warnings. - -// Although I cannot find where in the current C++ Reference Manual this -// topic is covered, I am sure that these statements should get ERRORs in -// a "strongly typed" language. - -// Cfront 2.0 passes this test. - -// keywords: array types, array bound, pointers - -int (*ptr_to_array_of_ints)[]; -int (*ptr_to_array_of_3_ints) [3]; -int (*ptr_to_array_of_5_ints) [5]; - -void function_0 () -{ - // we miss the first two because typeck.c (comp_array_types) deems - // it okay if one of the sizes is null - ptr_to_array_of_ints = ptr_to_array_of_3_ints; // ERROR - , XFAIL *-*-* - ptr_to_array_of_3_ints = ptr_to_array_of_ints; // ERROR - , XFAIL *-*-* - - ptr_to_array_of_3_ints = ptr_to_array_of_5_ints; // ERROR - - ptr_to_array_of_5_ints = ptr_to_array_of_3_ints; // ERROR - -} - -int main () { return 0; } + ptr_to_array_of_ints = ptr_to_array_of_3_ints; // ERROR - + ptr_to_array_of_3_ints = ptr_to_array_of_ints; // ERROR - diff --git a/gcc/testsuite/g++.old-deja/g++.bugs/900322_01.C b/gcc/testsuite/g++.old-deja/g++.bugs/900322_01.C index 961d95c08a9..388071e4fa0 100644 --- a/gcc/testsuite/g++.old-deja/g++.bugs/900322_01.C +++ b/gcc/testsuite/g++.old-deja/g++.bugs/900322_01.C @@ -1,51 +1,20 @@ -// g++ 1.37.1 bug 900322_01 - -// The ANSI C standard, in section 3.1.2.5 (first paragraph) differentiates -// types into three disjoint sets, i.e object types, function types, and -// incomplete types. - -// Also in 3.1.2.5 (page 24) the standard says that the element type of -// an array type is an object type. - -// Later in that same section the standard also notes that array types with -// unknown size are considered incomplete types (page 25). (Struct & union -// types which have only been "forward declared" are also incomplete types.) - -// Some experts infer this to mean that it is not legal to specify or to -// construct an array *type* whose element type is an incomplete type. - -// This interpretation suggests that the statements indicated below contain -// errors. - -// g++ fails to flag all of the indicated statements with errors (even when -// the -pedantic option is used). - -// keywords: incomplete types, arrays, element types - -extern int extern_two_d [] []; // ERROR - , XFAIL *-*-* -int tenative_two_d [] []; // ERROR - caught by g++ -static int static_two_d [] []; // ERROR - caught by g++ - -int (*pointer_to_two_d)[][]; // ERROR - , XFAIL *-*-* - -void function_0 (int arg [] []) { /* ERROR - */ -} - -typedef int int_one_d_type []; -typedef int_one_d_type int_two_d_type[];// ERROR - , XFAIL *-*-* - -struct s; - -extern struct s extern_s_array [10]; // ERROR - , XFAIL *-*-* -struct s tenative_s_array [10]; /* ERROR - caught by g++ */ -static struct s static_s_array [10]; /* ERROR - caught by g++ */ - -struct s (*pointer_to_s_array) []; // ERROR - , XFAIL *-*-* - -void function_1 (struct s arg []) { // ERROR - , XFAIL *-*-* -} - -typedef struct s s_type; -typedef s_type s_one_d_type [10]; // ERROR - , XFAIL *-*-* - -int main () { return 0; } +// ** Old, obsolete commentary: +// ************************************************************************** +// ************************************************************************** + +// The above commentary is wrong. (jason 1998/11/13) +// In fact, the lines marked OK are well-formed; the prohibition is only +// against forming array types with multiple unknown bounds. This prohibition +// is found in 8.3.4 [dcl.array]. + +// It is also ill-formed to create an object of incomplete type. +extern int extern_two_d [] []; // ERROR - invalid declaration +int (*pointer_to_two_d)[][]; // ERROR - invalid declaration +void function_0 (int arg [] []) { // ERROR - invalid declaration +typedef int_one_d_type int_two_d_type[];// ERROR - invalid declaration +extern struct s extern_s_array [10]; // OK +struct s tenative_s_array [10]; // ERROR - object with incomplete type +static struct s static_s_array [10]; // ERROR - object with incomplete type +struct s (*pointer_to_s_array) []; // OK +void function_1 (struct s arg []) { // OK +typedef s_type s_one_d_type [10]; // OK diff --git a/gcc/testsuite/g++.old-deja/g++.bugs/900428_01.C b/gcc/testsuite/g++.old-deja/g++.bugs/900428_01.C index b46fc466529..55b1aa86bb0 100644 --- a/gcc/testsuite/g++.old-deja/g++.bugs/900428_01.C +++ b/gcc/testsuite/g++.old-deja/g++.bugs/900428_01.C @@ -1,51 +1,26 @@ -// g++ 1.37.1 bug 900428_01 - -// g++ fails to issue error messages for cases where an incomplete type -// object must be evaluated if the value of such an evaluation is not -// actually used in the given context. - -// In the case where such an object is volatile, it is obvious that this -// could be a problem, however I believe that errors should be issued -// for such cases regardless of whether or not such values are volatile -// because the abstract semantics seem to require the evaluation of such -// values whether they are volatile or not. - -// keywords: incomplete types, evaluation, volatile qualifier -// Build don't link: - -int i; - -void *pv; -volatile void *pvv; -struct s; -extern struct s es, *ps; -extern volatile struct s evs, *pvs; - -void pv_test () -{ - *pv; // ERROR - , XFAIL *-*-* - (i ? *pv : *pv); // ERROR - , XFAIL *-*-* - *pv, *pv; // ERROR - , XFAIL *-*-* - - *pvv; // ERROR - , XFAIL *-*-* - (i ? *pvv : *pvv); // ERROR - , XFAIL *-*-* - *pvv, *pvv; // ERROR - , XFAIL *-*-* - - es; // ERROR - , XFAIL *-*-* - (i ? es : es); // ERROR - , XFAIL *-*-* - es, es; // ERROR - , XFAIL *-*-* - - evs; // ERROR - , XFAIL *-*-* - (i ? evs : evs); // ERROR - , XFAIL *-*-* - evs, evs; // ERROR - , XFAIL *-*-* - - *ps; // ERROR - , XFAIL *-*-* - (i ? *ps : *ps); // ERROR - , XFAIL *-*-* - *ps, *ps; // ERROR - , XFAIL *-*-* - - *pvs; // ERROR - , XFAIL *-*-* - (i ? *pvs : *pvs); // ERROR - , XFAIL *-*-* - *pvs, *pvs; // ERROR - , XFAIL *-*-* -} - -int main () { return 0; } +struct s; // ERROR - forward declaration +extern struct s es, *ps; // ERROR - defined here +extern volatile struct s evs, *pvs; // ERROR - defined here + *pv; // ERROR - invalid void + (i ? *pv : *pv); // ERROR - invalid void + *pv, *pv; // ERROR - invalid void + + *pvv; // ERROR - invalid void + (i ? *pvv : *pvv); // ERROR - invalid void + *pvv, *pvv; // ERROR - invalid void + + es; // ERROR - incomplete + (i ? es : es); // ERROR - undefined type + es, es; // ERROR - incomplete + + evs; // ERROR - incomplete + (i ? evs : evs); // ERROR - undefined type + evs, evs; // ERROR - incomplete + + *ps; // ERROR - undefined type + (i ? *ps : *ps); // ERROR - undefined type + *ps, *ps; // ERROR - undefined type + + *pvs; // ERROR - undefined type + (i ? *pvs : *pvs); // ERROR - undefined type + *pvs, *pvs; // ERROR - undefined type diff --git a/gcc/testsuite/g++.old-deja/g++.bugs/900511_02.C b/gcc/testsuite/g++.old-deja/g++.bugs/900511_02.C index 0154bfe4140..300e2121c16 100644 --- a/gcc/testsuite/g++.old-deja/g++.bugs/900511_02.C +++ b/gcc/testsuite/g++.old-deja/g++.bugs/900511_02.C @@ -1,21 +1,4 @@ -// g++ 1.37.1 bug 900511_02 - -// g++ does not properly shadow names of types with names of data members -// in cases where the type names in question are used in the context of -// formal parameters lists for member functions. - -// keywords: typedef names, shadowing, scope, formal parameter list - -// cfront 2.0 passes this test. - -enum enum0 { enum0_value_0 }; // ERROR - - -struct struct0 { - int enum0; // ERROR - - void member_function (enum0 e); -}; - -void class0::member_function (enum0 e) { // ERROR - -} - -int main () { return 0; } +enum enum0 { enum0_value_0 }; + int enum0; + void member_function (enum0 e); // ERROR - invalid use of struct-local member +void class0::member_function (enum0 e) { // ERROR - syntax error diff --git a/gcc/testsuite/g++.old-deja/g++.bugs/900511_03.C b/gcc/testsuite/g++.old-deja/g++.bugs/900511_03.C index d8a549aa82c..18dea85b397 100644 --- a/gcc/testsuite/g++.old-deja/g++.bugs/900511_03.C +++ b/gcc/testsuite/g++.old-deja/g++.bugs/900511_03.C @@ -1,19 +1,3 @@ -// g++ 1.37.1 bug 900511_03 - -// g++ does not properly shadow names of types with names of data members -// in cases where the type names in question are used in the context of -// formal parameters lists for member functions. - -// keywords: typedef names, shadowing, scope, formal parameter list - -class class0; // ERROR - - -struct struct1 { - int class0; // ERROR - - void member_function (class0 *); -}; - -void class1::member_function (class0 *p) { // ERROR - -} - -int main () { return 0; } +class class0; + int class0; + void member_function (class0 *); // ERROR - invalid use of struct-local member diff --git a/gcc/testsuite/g++.old-deja/g++.bugs/900519_13.C b/gcc/testsuite/g++.old-deja/g++.bugs/900519_13.C index 8161b59b801..7d5b25fd2b8 100644 --- a/gcc/testsuite/g++.old-deja/g++.bugs/900519_13.C +++ b/gcc/testsuite/g++.old-deja/g++.bugs/900519_13.C @@ -1,35 +1,3 @@ -// g++ 1.37.1 bug 900519_13 - -// If multiple inheritance creates a situation in which a given name is -// inherited from more than one base class, and if the inherited declarations -// for the name are for different categories of members (e.g. object members, -// function members, enumeral members), then g++ will (in some cases) fail -// to flag errors when the ambiguous name is used. - -// cfront 2.0 passes this test. - -// keywords: inheritance, ambiguity resolution, members - -struct base_0 { - enum { base_member }; -}; - -struct base_1 { - int base_member; -}; - -struct base_2 { - int base_member (); -}; - -struct derived_0 : public base_0, public base_1 { - void member () { base_member; } // ERROR - -}; - -struct derived_1 : public base_0, public base_2 { - void member () { base_member; } // ERROR - missed -}; - -struct derived_2 : public base_1, public base_2 { - void member () { base_member; } // ERROR - missed -}; + enum { base_member }; // ERROR - candidate (26, 30) + int base_member; // ERROR - candidate (26, 34) + int base_member (); // ERROR - candidate (30, 34) diff --git a/gcc/testsuite/g++.old-deja/g++.bugs/900520_02.C b/gcc/testsuite/g++.old-deja/g++.bugs/900520_02.C index 05c880d2e3c..9b58e81156b 100644 --- a/gcc/testsuite/g++.old-deja/g++.bugs/900520_02.C +++ b/gcc/testsuite/g++.old-deja/g++.bugs/900520_02.C @@ -1,34 +1,3 @@ -// g++ 1.37.1 bug 900520_02 - -// g++ fails to allow a reference to an unbounded array type to be passed -// into a formal parameter whose type is pointer-to-bounded-array type. - -// Cases other than parameter passing in which similar initializations -// take place are allowed however. - -// cfront 2.0 passes this test. - -// keywords: reference types, initialization, parameter passing - -typedef int b_array[3]; -typedef int u_array[]; - -typedef b_array &b_array_ref; -typedef u_array &u_array_ref; - -void take_b_array_ref (b_array_ref arg) { } - -extern u_array u_array_gbl_obj; - -u_array_ref u_array_ref_gbl_obj0 = u_array_gbl_obj; - -b_array_ref b_array_ref_gbl_obj0 = u_array_ref_gbl_obj0; // OK - -void test_passing () -{ - take_b_array_ref (u_array_ref_gbl_obj0); // gets bogus error -} - -b_array u_array_gbl_obj; - -int main () { return 0; } +void take_b_array_ref (b_array_ref arg) { } // ERROR - passed to here +b_array_ref b_array_ref_gbl_obj0 = u_array_ref_gbl_obj0; // ERROR - invalid declaration + take_b_array_ref (u_array_ref_gbl_obj0); // ERROR - invalid call diff --git a/gcc/testsuite/g++.old-deja/g++.eh/flow1.C b/gcc/testsuite/g++.old-deja/g++.eh/flow1.C index 81c70af3108..024670cf347 100644 --- a/gcc/testsuite/g++.old-deja/g++.eh/flow1.C +++ b/gcc/testsuite/g++.old-deja/g++.eh/flow1.C @@ -5,7 +5,7 @@ int bar () throw 100; } -main () +int main () { int i = 0; // this gets deleted after flow analysis try diff --git a/gcc/testsuite/g++.old-deja/g++.eh/new1.C b/gcc/testsuite/g++.old-deja/g++.eh/new1.C index 3f7ebbcba19..1671dbbe7de 100644 --- a/gcc/testsuite/g++.old-deja/g++.eh/new1.C +++ b/gcc/testsuite/g++.old-deja/g++.eh/new1.C @@ -17,7 +17,7 @@ void foo (B*); int newed, created; -main () +int main () { try { foo (new B (A ())); diff --git a/gcc/testsuite/g++.old-deja/g++.eh/new2.C b/gcc/testsuite/g++.old-deja/g++.eh/new2.C index 6699f94aa9f..ddc8ba82e58 100644 --- a/gcc/testsuite/g++.old-deja/g++.eh/new2.C +++ b/gcc/testsuite/g++.old-deja/g++.eh/new2.C @@ -17,8 +17,9 @@ void foo (B*); int newed, created; -main () +int main () { + newed = 0; // The libraries might call new before main starts. try { foo (new B (A ())); } catch (...) { } diff --git a/gcc/testsuite/g++.old-deja/g++.eh/pdel1.C b/gcc/testsuite/g++.old-deja/g++.eh/pdel1.C index b30b402d1be..b8e553c0e2f 100644 --- a/gcc/testsuite/g++.old-deja/g++.eh/pdel1.C +++ b/gcc/testsuite/g++.old-deja/g++.eh/pdel1.C @@ -12,7 +12,7 @@ struct A { void * operator new (size_t size, int, int) { return operator new (size); } -main () +int main () { try { A* ap = new (1, 5) A; diff --git a/gcc/testsuite/g++.old-deja/g++.eh/pdel2.C b/gcc/testsuite/g++.old-deja/g++.eh/pdel2.C index c9b9bd13edd..12efcd386cf 100644 --- a/gcc/testsuite/g++.old-deja/g++.eh/pdel2.C +++ b/gcc/testsuite/g++.old-deja/g++.eh/pdel2.C @@ -12,7 +12,7 @@ struct A { void * operator new (size_t size, int, int) { return operator new (size); } -main () +int main () { try { A* ap = new (1, 5) A; diff --git a/gcc/testsuite/g++.old-deja/g++.eh/rethrow3.C b/gcc/testsuite/g++.old-deja/g++.eh/rethrow3.C index bea447bf27f..5da2081b1b9 100644 --- a/gcc/testsuite/g++.old-deja/g++.eh/rethrow3.C +++ b/gcc/testsuite/g++.old-deja/g++.eh/rethrow3.C @@ -31,7 +31,7 @@ eh_test (int level) } } -main () +int main () { 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 8f450706b04..044af8cdb9b 100644 --- a/gcc/testsuite/g++.old-deja/g++.eh/spec1.C +++ b/gcc/testsuite/g++.old-deja/g++.eh/spec1.C @@ -13,7 +13,7 @@ f () throw (char, int, std::bad_exception) throw 'a'; } -main () +int main () { std::set_terminate (my_term); std::set_unexpected (my_unexp); diff --git a/gcc/testsuite/g++.old-deja/g++.eh/spec2.C b/gcc/testsuite/g++.old-deja/g++.eh/spec2.C index 41774bf7de4..d0269b3a4be 100644 --- a/gcc/testsuite/g++.old-deja/g++.eh/spec2.C +++ b/gcc/testsuite/g++.old-deja/g++.eh/spec2.C @@ -13,7 +13,7 @@ f () throw (int, std::bad_exception) throw 'a'; } -main () +int main () { std::set_terminate (my_term); std::set_unexpected (my_unexp); diff --git a/gcc/testsuite/g++.old-deja/g++.eh/spec3.C b/gcc/testsuite/g++.old-deja/g++.eh/spec3.C index 602cd6f5b61..57b29d48908 100644 --- a/gcc/testsuite/g++.old-deja/g++.eh/spec3.C +++ b/gcc/testsuite/g++.old-deja/g++.eh/spec3.C @@ -13,7 +13,7 @@ f () throw (std::bad_exception) throw 'a'; } -main () +int main () { std::set_terminate (my_term); std::set_unexpected (my_unexp); diff --git a/gcc/testsuite/g++.old-deja/g++.eh/spec4.C b/gcc/testsuite/g++.old-deja/g++.eh/spec4.C index adcf6751b1a..a92f7f06469 100644 --- a/gcc/testsuite/g++.old-deja/g++.eh/spec4.C +++ b/gcc/testsuite/g++.old-deja/g++.eh/spec4.C @@ -13,7 +13,7 @@ f () throw (short) throw 'a'; } -main () +int main () { std::set_terminate (my_term); std::set_unexpected (my_unexp); diff --git a/gcc/testsuite/g++.old-deja/g++.ext/default.C b/gcc/testsuite/g++.old-deja/g++.ext/default.C index 24f336e5882..29b55ae70ac 100644 --- a/gcc/testsuite/g++.old-deja/g++.ext/default.C +++ b/gcc/testsuite/g++.old-deja/g++.ext/default.C @@ -1,26 +1 @@ -// PRMS Id: 5353 -// This may be an extension, but it's a very common one... - -extern "C" int printf (const char *, ...); - -class A { -public: - static A*func (int = 3); - static A*(*ptr)(int = 4); -}; - -A*(*A::ptr)(int) = &A::func; - -main() -{ - A foo; - - A::ptr(); - A::ptr(47); -} - -A*A::func(int i) -{ - printf("I = %d\n",i); - return (A*)0; -} +int main() diff --git a/gcc/testsuite/g++.old-deja/g++.ext/implicit1.C b/gcc/testsuite/g++.old-deja/g++.ext/implicit1.C index 399d2329758..33b9450f6be 100644 --- a/gcc/testsuite/g++.old-deja/g++.ext/implicit1.C +++ b/gcc/testsuite/g++.old-deja/g++.ext/implicit1.C @@ -1,5 +1,5 @@ // test for implicit declaration -// Special g++ Options: -w +// Special g++ Options: -w -fpermissive int main () diff --git a/gcc/testsuite/g++.old-deja/g++.ext/null1.C b/gcc/testsuite/g++.old-deja/g++.ext/null1.C index 6650cbedde8..fca7aa3a92f 100644 --- a/gcc/testsuite/g++.old-deja/g++.ext/null1.C +++ b/gcc/testsuite/g++.old-deja/g++.ext/null1.C @@ -1,8 +1 @@ -// Test for overloading with g++ NULL. - -void f (int *) { } -void f (char, char); -main () -{ - f (__null); -} +int main () diff --git a/gcc/testsuite/g++.old-deja/g++.jason/2371.C b/gcc/testsuite/g++.old-deja/g++.jason/2371.C index a659b4eaea4..b11db5e0b33 100644 --- a/gcc/testsuite/g++.old-deja/g++.jason/2371.C +++ b/gcc/testsuite/g++.old-deja/g++.jason/2371.C @@ -502,7 +502,7 @@ operator<<(ostream& o, const SLS& s) SLS gsls; const SLS gcsls; -foo() +int foo() { const unsigned SIZE = 20; @@ -563,7 +563,7 @@ foo() } // Dummy function so it'll run -main() +int main() { cout << "PASS" << endl; } diff --git a/gcc/testsuite/g++.old-deja/g++.jason/access16.C b/gcc/testsuite/g++.old-deja/g++.jason/access16.C index 16a132a5b9f..b3b753c1a91 100644 --- a/gcc/testsuite/g++.old-deja/g++.jason/access16.C +++ b/gcc/testsuite/g++.old-deja/g++.jason/access16.C @@ -1,20 +1 @@ -// Bug: g++ uses the same binfo for the a subobject of c and the a subobject -// of b, so basetype_paths get bashed improperly. -// Build don't link: - -class a { -protected: - virtual void foo() { } // gets bogus error -}; - -class b : public virtual a {}; - -class c : public b { -public: - void bar() { b::foo(); } // gets bogus error -}; - -main() { - c test; - test.bar(); -} +int main() { diff --git a/gcc/testsuite/g++.old-deja/g++.jason/access17.C b/gcc/testsuite/g++.old-deja/g++.jason/access17.C index 9ed7d30d2a5..aaa1768b6a8 100644 --- a/gcc/testsuite/g++.old-deja/g++.jason/access17.C +++ b/gcc/testsuite/g++.old-deja/g++.jason/access17.C @@ -1,24 +1 @@ -// Make sure definitions of static members have the right access. -// Build don't link: - -struct A { -protected: - int i; - int f (); // ERROR - -}; - -struct B: public A { - static int A::*p; - static int (A::*fp)(); -}; - -int A::* B::p = &A::i; -int (A::* B::fp)() = &A::f; - -struct C { - static int A::*p; - static int (A::*fp)(); -}; - -int A::* C::p = &A::i; // ERROR - -int (A::* C::fp)() = &A::f; // ERROR - + int i; // ERROR - private diff --git a/gcc/testsuite/g++.old-deja/g++.jason/access22.C b/gcc/testsuite/g++.old-deja/g++.jason/access22.C index 736a053a591..29b55ae70ac 100644 --- a/gcc/testsuite/g++.old-deja/g++.jason/access22.C +++ b/gcc/testsuite/g++.old-deja/g++.jason/access22.C @@ -1,21 +1 @@ -// PRMS Id: 8518 -// Bug: Call to foo is not checked for accessibility - -class A -{ - private: - static void foo() {} // ERROR - - public: - void goo() {} -}; - -struct B : public A -{ - void func() { foo(); } // ERROR - -}; - -main() -{ - B b; - b.func(); -} +int main() diff --git a/gcc/testsuite/g++.old-deja/g++.jason/access23.C b/gcc/testsuite/g++.old-deja/g++.jason/access23.C index 57331687b7a..7975de2d8b5 100644 --- a/gcc/testsuite/g++.old-deja/g++.jason/access23.C +++ b/gcc/testsuite/g++.old-deja/g++.jason/access23.C @@ -1,79 +1,11 @@ -// PRMS Id: 9127 -// Bug: members of anonymous unions are not access-controlled. - -#include <stdio.h> - -struct Foo { -public: - union { - long A; - void *pX; - }; - union X { - long A; - void *pX; - } PUB ; - int PUB_A; -protected: - union { - long B; - void *pY; - } ; - union Y { - long B; - void *pY; - } PRT; - int PRT_A; -private: - union { - long C; - void *pZ; - }; - union Z { - long C; - void *pZ; - } PRV; - int PRV_A; -}; - -struct Bar : public Foo { -public: - DoSomething() { - PUB_A = 0; - Foo::A = 0; - printf("%x\n",pX); - Foo::PUB.A = 0; - printf("%x\n",PUB.pX); - B = 0; - printf("%x\n",Foo::pY); - PRT_A = 0; - PRT.B = 0; - printf("%x\n",Foo::PRT.pY); - PRV_A = 0; // ERROR - - Foo::C = 0; // ERROR - - printf("%x\n",pZ); // ERROR - - Foo::PRV.C = 0; // ERROR - - printf("%x\n",PRV.pZ); // ERROR - - } -}; - -main() -{ - Foo a; - - a.PUB_A = 0; - a.A = 0; - printf("%x\n",a.pX); - a.PRT_A = 0; // ERROR - - a.B = 0; // ERROR - - printf("%x\n",a.pY); // ERROR - - a.PRV_A = 0; // ERROR - - a.C = 0; // ERROR - - printf("%x\n",a.pZ); // ERROR - - a.PUB.A = 0; - printf("%x\n",a.PUB.pX); - a.PRT.B = 0; // ERROR - - printf("%x\n",a.PRT.pY); // ERROR - - a.PRV.C = 0; // ERROR - - printf("%x\n",a.PRV.pZ); // ERROR - -} + long B; // ERROR - protected + void *pY; // ERROR - protected + } PRT; // ERROR - protected + int PRT_A; // ERROR - protected + long C; // ERROR - private + void *pZ; // ERROR - private + long C; + } PRV; // ERROR - private + int PRV_A; // ERROR - private + void DoSomething() { +int main() diff --git a/gcc/testsuite/g++.old-deja/g++.jason/access7.C b/gcc/testsuite/g++.old-deja/g++.jason/access7.C index 708fa0fb626..788c86bff4f 100644 --- a/gcc/testsuite/g++.old-deja/g++.jason/access7.C +++ b/gcc/testsuite/g++.old-deja/g++.jason/access7.C @@ -1,13 +1 @@ -// Simple testcase for access control. -// Build don't link: - -class A { - protected: - static void f (); -}; - -class B: public A {}; -class C: public A {}; -class D: public C, public B { - void g () { A::f(); } // gets bogus error - wrongly ambiguous static member call, XFAIL *-*-* -}; + void g () { A::f(); } // gets bogus error - wrongly ambiguous static member call diff --git a/gcc/testsuite/g++.old-deja/g++.jason/aggregate.C b/gcc/testsuite/g++.old-deja/g++.jason/aggregate.C index b451b23ef7c..29b55ae70ac 100644 --- a/gcc/testsuite/g++.old-deja/g++.jason/aggregate.C +++ b/gcc/testsuite/g++.old-deja/g++.jason/aggregate.C @@ -1,13 +1 @@ -struct A { int i; }; - -main() -{ - A a1 = { 42 }; - A a2 (a1); - A a3 = { 137 }; - a1 = a3; - - if (a1.i == 137 && a2.i == 42 && a3.i == 137) - return 0; - return 1; -} +int main() diff --git a/gcc/testsuite/g++.old-deja/g++.jason/binding.C b/gcc/testsuite/g++.old-deja/g++.jason/binding.C index 0a013abd73e..29b55ae70ac 100644 --- a/gcc/testsuite/g++.old-deja/g++.jason/binding.C +++ b/gcc/testsuite/g++.old-deja/g++.jason/binding.C @@ -1,11 +1 @@ -// Bug: g++ only looks in the current temporary binding level for a name. - -struct T { ~T(); }; - -main() -{ - foo: - T t; // ERROR - redeclared - bar: - T t; // ERROR - redeclaration -} +int main() diff --git a/gcc/testsuite/g++.old-deja/g++.jason/bool2.C b/gcc/testsuite/g++.old-deja/g++.jason/bool2.C index 4c0edcb3596..559b7d07615 100644 --- a/gcc/testsuite/g++.old-deja/g++.jason/bool2.C +++ b/gcc/testsuite/g++.old-deja/g++.jason/bool2.C @@ -5,7 +5,7 @@ struct F { bool b2 : 7; }; -main() +int main() { F f = { true, true }; diff --git a/gcc/testsuite/g++.old-deja/g++.jason/bool4.C b/gcc/testsuite/g++.old-deja/g++.jason/bool4.C index 36a2180c927..fca7aa3a92f 100644 --- a/gcc/testsuite/g++.old-deja/g++.jason/bool4.C +++ b/gcc/testsuite/g++.old-deja/g++.jason/bool4.C @@ -1,10 +1 @@ -// Test for allowing conversion to bool. - -struct A { }; - -main () -{ - bool b = (void*)0; - b = (int A::*)0; - b = (int (A::*)())0; -} +int main () diff --git a/gcc/testsuite/g++.old-deja/g++.jason/bool5.C b/gcc/testsuite/g++.old-deja/g++.jason/bool5.C index 79d848c0b19..fca7aa3a92f 100644 --- a/gcc/testsuite/g++.old-deja/g++.jason/bool5.C +++ b/gcc/testsuite/g++.old-deja/g++.jason/bool5.C @@ -1,10 +1 @@ -main () -{ - bool b = false; - int i = b++; - if (i != false || b != true) - return 1; - i = b++; - if (i != true || b != true) - return 1; -} +int main () diff --git a/gcc/testsuite/g++.old-deja/g++.jason/bool6.C b/gcc/testsuite/g++.old-deja/g++.jason/bool6.C index b8db8722b8f..fca7aa3a92f 100644 --- a/gcc/testsuite/g++.old-deja/g++.jason/bool6.C +++ b/gcc/testsuite/g++.old-deja/g++.jason/bool6.C @@ -1,9 +1 @@ -// Bug: The conversion from bool to int gets stripped. -// Build don't link: - -bool b; - -main () -{ - return ((!b) != 0); -} +int main () diff --git a/gcc/testsuite/g++.old-deja/g++.jason/byval.C b/gcc/testsuite/g++.old-deja/g++.jason/byval.C index 45fb1e2836b..29b55ae70ac 100644 --- a/gcc/testsuite/g++.old-deja/g++.jason/byval.C +++ b/gcc/testsuite/g++.old-deja/g++.jason/byval.C @@ -1,19 +1 @@ -// Bug: a is destroyed in both foo() and main() - -int count; - -struct A { - double a,b; - A(int) { count++; } - A(const A&) { count++; } - ~A() { count--; } -}; - -void foo (A a) -{ } - -main() -{ - foo (1); - return count; -} +int main() diff --git a/gcc/testsuite/g++.old-deja/g++.jason/cleanup2.C b/gcc/testsuite/g++.old-deja/g++.jason/cleanup2.C index 21addfe67d7..b3b753c1a91 100644 --- a/gcc/testsuite/g++.old-deja/g++.jason/cleanup2.C +++ b/gcc/testsuite/g++.old-deja/g++.jason/cleanup2.C @@ -1,15 +1 @@ -// PRMS Id: 6303 -// Bug: compiler crashes processing the cleanup for arrayOfClass. -// Build don't link: - -class Class { -public: - ~Class(); // This dtor MUST be declared to generate the error... -}; - -Class varOfClass; - -main() { - // This MUST be 'const' to generate the error... - const Class arrayOfClass[1] = { varOfClass }; // causes abort -} +int main() { diff --git a/gcc/testsuite/g++.old-deja/g++.jason/cond.C b/gcc/testsuite/g++.old-deja/g++.jason/cond.C index 8f4da347bb6..29b55ae70ac 100644 --- a/gcc/testsuite/g++.old-deja/g++.jason/cond.C +++ b/gcc/testsuite/g++.old-deja/g++.jason/cond.C @@ -1,39 +1 @@ -// Build don't link: -// GROUPS passed rtti -// Negative testcase for decls in conditions. - -main() -{ - float i; - - if (int i = 1) // ERROR - , XFAIL *-*-* - { - char i; // ERROR - , XFAIL *-*-* - char j; - } - else - { - short i; // ERROR - , XFAIL *-*-* - char j; - } - - if (struct A { operator int () { return 1; } } *foo = new A) // ERROR - - ; - - A bar; // ERROR - - - if (enum A { one, two, three } foo = one) // ERROR - - ; - - struct B { operator int () { return 2; } }; - - if (struct B * foo = new B) - ; - - if (int f () = 1) // ERROR - - ; - - if (int a[2] = {1, 2}) // ERROR - - ; - -} +int main() diff --git a/gcc/testsuite/g++.old-deja/g++.jason/cond2.C b/gcc/testsuite/g++.old-deja/g++.jason/cond2.C index 890c3193d3d..fca7aa3a92f 100644 --- a/gcc/testsuite/g++.old-deja/g++.jason/cond2.C +++ b/gcc/testsuite/g++.old-deja/g++.jason/cond2.C @@ -1,65 +1 @@ -// Positive testcase for decls in conditions. - -extern "C" int printf(const char *, ...); - -int up = 0; -int down = 0; - -struct T -{ - int i; - T(int j) { i = j; printf("UP\n"); up++; } - T(const T& t) { i = t.i; printf("unwanted copy\n"); } - ~T() { printf ("DOWN\n"); down++; } - operator int () { return i; } -}; - -main () -{ - int t; - - if (T t = 1) - ; - - printf ("\n"); - - int j = 3; - while (T t = j--) - ; - - printf ("\n"); - - j = 3; - while (1) - { - T t = j--; - if (t) continue; - break; - } - - printf ("\n"); - - j = 3; - for (;T t = j--;) - ; - - printf ("\n"); - - for (int k = 3; T t = k--;) - ; - - printf ("\n"); - - switch (T t = 34) - { - case 34: - ; - } - - printf ("\n"); - - if (up == down && up == 18) - return 0; - else - return 1; -} +int main () diff --git a/gcc/testsuite/g++.old-deja/g++.jason/const2.C b/gcc/testsuite/g++.old-deja/g++.jason/const2.C index 3aeae3c7e71..8b8d58de0ed 100644 --- a/gcc/testsuite/g++.old-deja/g++.jason/const2.C +++ b/gcc/testsuite/g++.old-deja/g++.jason/const2.C @@ -1,14 +1 @@ -// Example of static member constants - -extern "C" int printf (const char *, ...); - -struct T { - static const char letter = 'a'; // this is the new stuff! - char x[letter]; - void f(); -}; - -void T::f() { printf ("%p", &letter); } -const char T::letter; // still need def after class - -main() { } +int main() { } diff --git a/gcc/testsuite/g++.old-deja/g++.jason/const3.C b/gcc/testsuite/g++.old-deja/g++.jason/const3.C index 49360a4fabe..29b55ae70ac 100644 --- a/gcc/testsuite/g++.old-deja/g++.jason/const3.C +++ b/gcc/testsuite/g++.old-deja/g++.jason/const3.C @@ -1,10 +1 @@ -// Bug: bar isn't emitted, which causes havoc. - -extern int i; -const int bar = i; -int i = 5; - -main() -{ - return bar != 5; -} +int main() diff --git a/gcc/testsuite/g++.old-deja/g++.jason/conversion6.C b/gcc/testsuite/g++.old-deja/g++.jason/conversion6.C index 42b9ac226d8..090a634bc24 100644 --- a/gcc/testsuite/g++.old-deja/g++.jason/conversion6.C +++ b/gcc/testsuite/g++.old-deja/g++.jason/conversion6.C @@ -1,40 +1 @@ -// PRMS Id: g++/6034 - -extern "C" int printf (const char *, ...); - -class Base -{ - char x; -}; - -template <class T> -// remove the public Base inheritance and the problem goes away... -class Container : public Base -{ -public: - - Container(const T& aValue): myValue(aValue) { } - - operator const T&(void) const - { - printf("Container::const T& called\n"); - return myValue; - } - -protected: - - T myValue; -}; - -typedef unsigned short Type; - -typedef Container<Type> TypeContainer; - -main(void) -{ - TypeContainer myTypeContainer(2); - Type t = myTypeContainer; - - printf ("myType = %d\n", t); - return t != 2; -} +int main(void) diff --git a/gcc/testsuite/g++.old-deja/g++.jason/conversion8.C b/gcc/testsuite/g++.old-deja/g++.jason/conversion8.C index fc4de8111b8..fca7aa3a92f 100644 --- a/gcc/testsuite/g++.old-deja/g++.jason/conversion8.C +++ b/gcc/testsuite/g++.old-deja/g++.jason/conversion8.C @@ -1,10 +1 @@ -// PRMS id: 8279 - -main () -{ - char *const *p = 0; - char **q = 0; - - (void)(p - q); - (void)(q - p); -} +int main () diff --git a/gcc/testsuite/g++.old-deja/g++.jason/crash8.C b/gcc/testsuite/g++.old-deja/g++.jason/crash8.C index 4482a43f4bc..29b55ae70ac 100644 --- a/gcc/testsuite/g++.old-deja/g++.jason/crash8.C +++ b/gcc/testsuite/g++.old-deja/g++.jason/crash8.C @@ -1,9 +1 @@ -struct A { - A(); - A(A); // ERROR - copy ctor must take reference -}; -main() -{ - A a; - A b(a); // causes compiler segfault -} +int main() diff --git a/gcc/testsuite/g++.old-deja/g++.jason/ctor1.C b/gcc/testsuite/g++.old-deja/g++.jason/ctor1.C index 69afd425519..106ff4283c9 100644 --- a/gcc/testsuite/g++.old-deja/g++.jason/ctor1.C +++ b/gcc/testsuite/g++.old-deja/g++.jason/ctor1.C @@ -1,26 +1,2 @@ -// PRMS Id: 5584 - -extern "C" -{ - struct xx { - void (*xx)(void); - int x,y; - }; -} - -int r = 1; - -void f(void) -{ - r = 0; -} - -main() -{ - struct xx p; - - p.xx = f; - p.xx(); - - return r; -} + void (*xx)(void); // ERROR - field with name of class +int main() diff --git a/gcc/testsuite/g++.old-deja/g++.jason/dcast2.C b/gcc/testsuite/g++.old-deja/g++.jason/dcast2.C index 2ba1357fd62..fca7aa3a92f 100644 --- a/gcc/testsuite/g++.old-deja/g++.jason/dcast2.C +++ b/gcc/testsuite/g++.old-deja/g++.jason/dcast2.C @@ -1,18 +1 @@ -struct A { virtual void f() { } }; -struct B { virtual void g() { } }; -struct C : public A, public B { }; - -main () -{ - C* cp = 0; - B* bp = 0; - - if (dynamic_cast <B*> (cp) != 0) - return 1; - - if (dynamic_cast <void *> (bp) != 0) - return 1; - - if (dynamic_cast <C*> (bp) != 0) - return 1; -} +int main () diff --git a/gcc/testsuite/g++.old-deja/g++.jason/dcast3.C b/gcc/testsuite/g++.old-deja/g++.jason/dcast3.C index 1dc00a138eb..fca7aa3a92f 100644 --- a/gcc/testsuite/g++.old-deja/g++.jason/dcast3.C +++ b/gcc/testsuite/g++.old-deja/g++.jason/dcast3.C @@ -1,32 +1 @@ -// Testcase for tricky dynamic cast situations. - -struct A { - virtual void f () { } -}; - -struct B : public A { }; -struct C : public B { }; -struct D : public B { }; -struct E : public C, public D { }; - -struct B2 : public virtual A { }; -struct C2 : public B2 { }; -struct D2 : public B2 { }; -struct E2 : public C2, public D2 { }; - -main () -{ - E e; - E2 e2; - - A* ap = (C*)&e; - - // ap points to base subobject of unique B; succeeds - if (dynamic_cast <B*> (ap) == 0) - return 1; - - ap = (C2*)&e2; - // ap points to base subobject shared by two Bs; fails - if (dynamic_cast <B2*> (ap) != 0) - return 1; -} +int main () diff --git a/gcc/testsuite/g++.old-deja/g++.jason/default1.C b/gcc/testsuite/g++.old-deja/g++.jason/default1.C index e6ef57768e0..29b55ae70ac 100644 --- a/gcc/testsuite/g++.old-deja/g++.jason/default1.C +++ b/gcc/testsuite/g++.old-deja/g++.jason/default1.C @@ -1,16 +1 @@ -// PRMS Id: 5204 -// Bug: g++ bashes the type of add_sym with the type of add, so calling it -// with one parameter generates an error. -// Build don't link: - -int add(int const &symbol, - const unsigned char flags=(void*)0); // ERROR - invalid default arg - -int add_sym(int const &symbol, - const unsigned char flags=0); - -main() -{ - int fname; - add_sym(fname); // Guarantee a symbol exists -} +int main() diff --git a/gcc/testsuite/g++.old-deja/g++.jason/defctor.C b/gcc/testsuite/g++.old-deja/g++.jason/defctor.C index 252d43ef6ad..765014bc66d 100644 --- a/gcc/testsuite/g++.old-deja/g++.jason/defctor.C +++ b/gcc/testsuite/g++.old-deja/g++.jason/defctor.C @@ -1,15 +1 @@ -// Bug: g++ doesn't generate default constructor. - -class A { -public: - int i; -}; - -extern "C" int printf(const char *, ...); - -main () { - A a; - a.i = 1; - A b (a); - printf("%d\n",b.i); -} +int main () { diff --git a/gcc/testsuite/g++.old-deja/g++.jason/destruct.C b/gcc/testsuite/g++.old-deja/g++.jason/destruct.C index a9d7e86a467..fca7aa3a92f 100644 --- a/gcc/testsuite/g++.old-deja/g++.jason/destruct.C +++ b/gcc/testsuite/g++.old-deja/g++.jason/destruct.C @@ -1,33 +1 @@ -// Exhaustive test for destructors of simple types. -// PRMS Id: 2744, 3308 -// Build don't link: - -template <class T> class A { - T q; -public: - ~A() { - q.T::~T(); - q.~T(); - (&q)->T::~T(); - (&q)->~T(); - } -}; - -typedef char * cp; - -main () -{ - A<int> a; - A<cp> b; - int i; - cp c; - - i.~int(); - i.int::~int(); - (&i)->~int(); - (&i)->int::~int(); - c.~cp(); - c.cp::~cp(); - (&c)->~cp(); - (&c)->cp::~cp(); -} +int main () diff --git a/gcc/testsuite/g++.old-deja/g++.jason/dot.C b/gcc/testsuite/g++.old-deja/g++.jason/dot.C index 7f4bd7776d4..29b55ae70ac 100644 --- a/gcc/testsuite/g++.old-deja/g++.jason/dot.C +++ b/gcc/testsuite/g++.old-deja/g++.jason/dot.C @@ -1,20 +1 @@ -// PRMS Id: 4143 -// Bug: Pointer is silently dereferenced in method call. -// Build don't link: - -extern "C" int printf (const char *, ...); - -class Test -{ - char ch; - public: - Test(char c) : ch(c) {} - void Print() { printf("%c", ch); } -}; - -main() -{ - Test *p = new Test('x'); - - p.Print(); // ERROR - -} +int main() diff --git a/gcc/testsuite/g++.old-deja/g++.jason/dtor.C b/gcc/testsuite/g++.old-deja/g++.jason/dtor.C index c9e71628d09..29b55ae70ac 100644 --- a/gcc/testsuite/g++.old-deja/g++.jason/dtor.C +++ b/gcc/testsuite/g++.old-deja/g++.jason/dtor.C @@ -1,13 +1 @@ -struct A { - ~A(); -}; - -struct B { - ~B(); -}; - -main() -{ - A a; - a.~B(); // ERROR - wrong name -} +int main() diff --git a/gcc/testsuite/g++.old-deja/g++.jason/dtor2.C b/gcc/testsuite/g++.old-deja/g++.jason/dtor2.C index 7f975136e8d..29b55ae70ac 100644 --- a/gcc/testsuite/g++.old-deja/g++.jason/dtor2.C +++ b/gcc/testsuite/g++.old-deja/g++.jason/dtor2.C @@ -1,10 +1 @@ -// PRMS Id: 5163 -// Bug: g++ doesn't accept the explicit destructor call syntax for templates. - -template <class T> struct A { }; -A<int> a; - -main() -{ - a.~A(); // gets bogus error -} +int main() diff --git a/gcc/testsuite/g++.old-deja/g++.jason/dtor5.C b/gcc/testsuite/g++.old-deja/g++.jason/dtor5.C index 8ad14eabce8..4761bedf2cc 100644 --- a/gcc/testsuite/g++.old-deja/g++.jason/dtor5.C +++ b/gcc/testsuite/g++.old-deja/g++.jason/dtor5.C @@ -12,7 +12,7 @@ template <class T> struct A { ~A() { p[--i].~T(); r = i; } }; -main() +int main() { { A<int> a; } diff --git a/gcc/testsuite/g++.old-deja/g++.jason/enum8.C b/gcc/testsuite/g++.old-deja/g++.jason/enum8.C index 811b44cf29b..fca7aa3a92f 100644 --- a/gcc/testsuite/g++.old-deja/g++.jason/enum8.C +++ b/gcc/testsuite/g++.old-deja/g++.jason/enum8.C @@ -1,20 +1 @@ -// Bug: the switch fails on the Alpha because folding ef - 1 fails. - -enum foo { one=1, thirty=30 }; - -int f (enum foo ef) -{ - switch (ef) - { - case one: - case thirty: - return 0; - default: - return 1; - } -} - -main () -{ - return f (one); -} +int main () diff --git a/gcc/testsuite/g++.old-deja/g++.jason/friend.C b/gcc/testsuite/g++.old-deja/g++.jason/friend.C index ee6ee8d5eae..fca7aa3a92f 100644 --- a/gcc/testsuite/g++.old-deja/g++.jason/friend.C +++ b/gcc/testsuite/g++.old-deja/g++.jason/friend.C @@ -1,18 +1 @@ -// Bug: g++ doesn't keep track of the lexical context of friends properly. - -extern "C" void exit(int); - -struct B; -struct A { - static void f () { exit (1); } -}; - -struct B { - static void f () { exit (0); } - friend void g () { f (); } -}; - -main () -{ - g (); -} +int main () diff --git a/gcc/testsuite/g++.old-deja/g++.jason/groff1.C b/gcc/testsuite/g++.old-deja/g++.jason/groff1.C index 79a96438ad9..29b55ae70ac 100644 --- a/gcc/testsuite/g++.old-deja/g++.jason/groff1.C +++ b/gcc/testsuite/g++.old-deja/g++.jason/groff1.C @@ -1,40 +1 @@ -// PRMS Id: 3744 -// Bug: unswitching a COND_EXPR initializer fails to set SIDE_EFFECTS on the -// result, so expand_expr ignores it. - -extern "C" { - int printf(const char *,...); - void exit(int); -} - -struct A { - int x; - int y; - - A() : x(0), y(0) { } -}; - -struct S { - S() : flags(0) { } - unsigned flags; - A from; - void foo(const A &pos); -}; - -void S::foo(const A &pos) -{ - A a = flags ? from : pos; - printf("%d %d\n", a.x, a.y); - if (a.x != 17 || a.y != 12) - exit (1); -} - -main() -{ - A pos; - pos.x = 17; - pos.y = 12; - S s; - s.foo(pos); - return 0; -} +int main() diff --git a/gcc/testsuite/g++.old-deja/g++.jason/hmc1.C b/gcc/testsuite/g++.old-deja/g++.jason/hmc1.C index 751cf80f481..b3b753c1a91 100644 --- a/gcc/testsuite/g++.old-deja/g++.jason/hmc1.C +++ b/gcc/testsuite/g++.old-deja/g++.jason/hmc1.C @@ -1,19 +1 @@ -// Build don't link: -// GROUPS passed templates default-arguments -template <class I> -class Class { -public: - void func1(int n=1); - void func2(int d) {} -}; -template <class I> -void Class<I>::func1(int n) {} - -//if this is replaced by: -//void Class<I>::func1(int n=1) {} -//the code compiles. - -main() { - Class<int> C; - return 0; -} +int main() { diff --git a/gcc/testsuite/g++.old-deja/g++.jason/init2.C b/gcc/testsuite/g++.old-deja/g++.jason/init2.C index dcee91835dc..29b55ae70ac 100644 --- a/gcc/testsuite/g++.old-deja/g++.jason/init2.C +++ b/gcc/testsuite/g++.old-deja/g++.jason/init2.C @@ -1,9 +1 @@ -// PRMS Id: 5126 - -extern int i, j; -static const int foo [] = { i, j }; -int i = 5, j = 42; -main() -{ - return foo[1] != 42; -} +int main() diff --git a/gcc/testsuite/g++.old-deja/g++.jason/init3.C b/gcc/testsuite/g++.old-deja/g++.jason/init3.C index bb3d0d8cf10..29b55ae70ac 100644 --- a/gcc/testsuite/g++.old-deja/g++.jason/init3.C +++ b/gcc/testsuite/g++.old-deja/g++.jason/init3.C @@ -1,42 +1 @@ -// PRMS Id: 5652 -// Bug: strings does not get initialized. - -extern "C" void * memcpy (void *, const void *, __SIZE_TYPE__); -extern "C" int strcmp (const char *, const char *); - -class My_string { - char *str; - int len; -public: - My_string(const char* string); - My_string(const My_string &); - ~My_string() { delete str; } - char* char_p() { return str; } -}; - -const My_string strings[4] = { - "first string", - "second string", - "third string", - "fourth string" -}; - -My_string::My_string(const char* string) -{ - len = strlen(string) + 1; - str = new char[len]; - memcpy(str, string, len); -} - -My_string::My_string(const My_string &string) -{ - len = string.len; - str = new char[len]; - memcpy(str, string.str, len); -} - -main() -{ - My_string str1 = strings[0]; - return strcmp ("first string", str1.char_p ()) != 0; -} +int main() diff --git a/gcc/testsuite/g++.old-deja/g++.jason/inline.C b/gcc/testsuite/g++.old-deja/g++.jason/inline.C index ac140ab6744..29b55ae70ac 100644 --- a/gcc/testsuite/g++.old-deja/g++.jason/inline.C +++ b/gcc/testsuite/g++.old-deja/g++.jason/inline.C @@ -1,21 +1 @@ -// PRMS Id: 4341 -// Bug: Instantiating a template in the middle of processing the functions -// from another template screws up lineno/input_filename. - -#pragma implementation "C.h" -#line 1 "A.h" -#pragma interface -template <class T> class A {}; -#line 1 "C.h" -#pragma interface -template <class T> class C -{ -public: - C() { A<T> *ap; } - ~C() { } -}; -#line 18 "inline.C" -main() -{ - C<int> c; -} +int main() diff --git a/gcc/testsuite/g++.old-deja/g++.jason/jump.C b/gcc/testsuite/g++.old-deja/g++.jason/jump.C index 754e7006c36..b3b753c1a91 100644 --- a/gcc/testsuite/g++.old-deja/g++.jason/jump.C +++ b/gcc/testsuite/g++.old-deja/g++.jason/jump.C @@ -1,14 +1 @@ -// PRMS Id: 6036 - -extern int a; - -main() { - switch (a) { - case 1: - int v2 = 3; // ERROR - referenced below - case 2: // ERROR - jumping past initializer - if (v2 == 7) - ; - } - return 0; -} +int main() { diff --git a/gcc/testsuite/g++.old-deja/g++.jason/lex1.C b/gcc/testsuite/g++.old-deja/g++.jason/lex1.C index 69fb0b7bbea..29b55ae70ac 100644 --- a/gcc/testsuite/g++.old-deja/g++.jason/lex1.C +++ b/gcc/testsuite/g++.old-deja/g++.jason/lex1.C @@ -1,6 +1 @@ -main() -{ - char c = '\351'; - if (c != '\351') - return 1; -} +int main() diff --git a/gcc/testsuite/g++.old-deja/g++.jason/lineno5.C b/gcc/testsuite/g++.old-deja/g++.jason/lineno5.C index f15aef05fce..29b55ae70ac 100644 --- a/gcc/testsuite/g++.old-deja/g++.jason/lineno5.C +++ b/gcc/testsuite/g++.old-deja/g++.jason/lineno5.C @@ -1,10 +1 @@ -// Build don't link: -// GROUPS passed error-reporting -// Bug: incomplete instantiation messes with lineno -template <class T> class A; - -main() -{ - A<int> *p; - undef1();// ERROR - -} +int main() diff --git a/gcc/testsuite/g++.old-deja/g++.jason/lvalue4.C b/gcc/testsuite/g++.old-deja/g++.jason/lvalue4.C index f308213bcc4..b3b753c1a91 100644 --- a/gcc/testsuite/g++.old-deja/g++.jason/lvalue4.C +++ b/gcc/testsuite/g++.old-deja/g++.jason/lvalue4.C @@ -1,6 +1 @@ -main() { - int i = 2; - int *pi = &(++i); - - return i != 3; -} +int main() { diff --git a/gcc/testsuite/g++.old-deja/g++.jason/member1.C b/gcc/testsuite/g++.old-deja/g++.jason/member1.C deleted file mode 100644 index c25a1904a4a..00000000000 --- a/gcc/testsuite/g++.old-deja/g++.jason/member1.C +++ /dev/null @@ -1,4 +0,0 @@ -// Build don't link: - -struct S { int S; } object; -struct S function () { return object; } diff --git a/gcc/testsuite/g++.old-deja/g++.jason/mi.C b/gcc/testsuite/g++.old-deja/g++.jason/mi.C index eaf59b20233..fca7aa3a92f 100644 --- a/gcc/testsuite/g++.old-deja/g++.jason/mi.C +++ b/gcc/testsuite/g++.old-deja/g++.jason/mi.C @@ -1,16 +1 @@ -int status; - -struct A { virtual void foo () { status = 1; } }; -struct B { }; -struct C : public A, public B { }; -struct D { virtual void baz () { } }; -struct E : public D, public C { void foo () { status = 0; } }; - -main () -{ - E* ep = new E; - - ep->foo(); - - return status; -} +int main () diff --git a/gcc/testsuite/g++.old-deja/g++.jason/mutable1.C b/gcc/testsuite/g++.old-deja/g++.jason/mutable1.C index 9298d2ef882..fca7aa3a92f 100644 --- a/gcc/testsuite/g++.old-deja/g++.jason/mutable1.C +++ b/gcc/testsuite/g++.old-deja/g++.jason/mutable1.C @@ -1,11 +1 @@ -struct X -{ - X () { } - mutable int x; -}; - -main () -{ - const X x; - x.x = 0; -} +int main () diff --git a/gcc/testsuite/g++.old-deja/g++.jason/new.C b/gcc/testsuite/g++.old-deja/g++.jason/new.C index 0ac2562d7f9..ce865696078 100644 --- a/gcc/testsuite/g++.old-deja/g++.jason/new.C +++ b/gcc/testsuite/g++.old-deja/g++.jason/new.C @@ -13,13 +13,13 @@ void * operator new (size_t siz) throw (std::bad_alloc) { return malloc (siz); } -main() +int main() { s = 0; float f = 3; int* b1 = new int[(int)f]; - int* b2 = new int[f]; + int* b2 = new int[f]; // ERROR - new requires integral size return s; } diff --git a/gcc/testsuite/g++.old-deja/g++.jason/new5.C b/gcc/testsuite/g++.old-deja/g++.jason/new5.C index 70f5ec5d475..fca7aa3a92f 100644 --- a/gcc/testsuite/g++.old-deja/g++.jason/new5.C +++ b/gcc/testsuite/g++.old-deja/g++.jason/new5.C @@ -1,5 +1 @@ -main () -{ - const int *p = new const int (0); - delete p; -} +int main () diff --git a/gcc/testsuite/g++.old-deja/g++.jason/offset2.C b/gcc/testsuite/g++.old-deja/g++.jason/offset2.C index 787e3f12081..29b55ae70ac 100644 --- a/gcc/testsuite/g++.old-deja/g++.jason/offset2.C +++ b/gcc/testsuite/g++.old-deja/g++.jason/offset2.C @@ -1,23 +1 @@ -// PRMS Id: 5070 (testcase 2) - -int status = 1; - -struct foo { - foo& operator= (const foo&) { status = 0; } -}; - -struct xx { - foo a; -}; - -struct yy : public xx { - yy(foo& a) { xx::a = a; } -}; - -main() -{ - foo f; - yy y (f); - - return status; -} +int main() diff --git a/gcc/testsuite/g++.old-deja/g++.jason/operator.C b/gcc/testsuite/g++.old-deja/g++.jason/operator.C index e71c4e10544..bd21e378e14 100644 --- a/gcc/testsuite/g++.old-deja/g++.jason/operator.C +++ b/gcc/testsuite/g++.old-deja/g++.jason/operator.C @@ -2,7 +2,7 @@ // Build don't link: // Special g++ Options: -typedef unsigned long size_t; +typedef __SIZE_TYPE__ size_t; struct A { int operator?:(int a, int b); // WARNING - diff --git a/gcc/testsuite/g++.old-deja/g++.jason/overload11.C b/gcc/testsuite/g++.old-deja/g++.jason/overload11.C index e8c043f0545..29b55ae70ac 100644 --- a/gcc/testsuite/g++.old-deja/g++.jason/overload11.C +++ b/gcc/testsuite/g++.old-deja/g++.jason/overload11.C @@ -1,17 +1 @@ -// PRMS Id: 4697 -// Bug: g++ calls the non-const method for a const object. - -class A { -public: - void foo(int &i) const { i = 0; } - void foo(int &i) { i = 1; } -}; - -main() -{ - A a; - const A& b = a; - int i = 2; - b.foo (i); - return i; -} +int main() diff --git a/gcc/testsuite/g++.old-deja/g++.jason/overload12.C b/gcc/testsuite/g++.old-deja/g++.jason/overload12.C index dc336c5caed..29b55ae70ac 100644 --- a/gcc/testsuite/g++.old-deja/g++.jason/overload12.C +++ b/gcc/testsuite/g++.old-deja/g++.jason/overload12.C @@ -1,15 +1 @@ -// PRMS Id: 4066 -// Bug: g++ doesn't notice the const on reference returns. - -struct B { - int foo() { return 1; } - int foo() const { return 0; } -}; - -B b_; -const B &b () { return b_; } - -main() -{ - return b().foo(); -} +int main() diff --git a/gcc/testsuite/g++.old-deja/g++.jason/overload13.C b/gcc/testsuite/g++.old-deja/g++.jason/overload13.C index 602dc2b4e1d..b3b753c1a91 100644 --- a/gcc/testsuite/g++.old-deja/g++.jason/overload13.C +++ b/gcc/testsuite/g++.old-deja/g++.jason/overload13.C @@ -1,27 +1 @@ -// Bug: g++ screws up derived->base conversions when calling a global function -// in the presence of matching members in the base. Whew. - -struct xios { - virtual ~xios() { } -}; - -struct xistream: virtual public xios { - int j; - void operator>>(char&); -}; - -struct xfstreambase: virtual public xios { }; - -struct xifstream: public xfstreambase, public xistream { }; - -void operator>>(xistream& i, int j) -{ - i.j = 0; -} - -main() { - int i; - xifstream ifs; - - ifs >> i; -} +int main() { diff --git a/gcc/testsuite/g++.old-deja/g++.jason/overload16.C b/gcc/testsuite/g++.old-deja/g++.jason/overload16.C index e1b7f3f8a1f..29b55ae70ac 100644 --- a/gcc/testsuite/g++.old-deja/g++.jason/overload16.C +++ b/gcc/testsuite/g++.old-deja/g++.jason/overload16.C @@ -1,6 +1 @@ -void f (int); // ERROR - -void f (long); // ERROR - -main() -{ - f (1 & 0xffffff00UL); // ERROR - ambiguous -} +int main() diff --git a/gcc/testsuite/g++.old-deja/g++.jason/overload20.C b/gcc/testsuite/g++.old-deja/g++.jason/overload20.C index dde686c5c30..8f72c24e975 100644 --- a/gcc/testsuite/g++.old-deja/g++.jason/overload20.C +++ b/gcc/testsuite/g++.old-deja/g++.jason/overload20.C @@ -1,11 +1,2 @@ -// Bug: this code causes an internal compiler error 4. - -void f (char *); -void f (int); -struct A { - void f (); - void f (int); - void g () { - void (*p)(char *) = f; // ERROR - no matching function in scope - } -}; + void f (); // ERROR - candidate + void f (int); // ERROR - candidate diff --git a/gcc/testsuite/g++.old-deja/g++.jason/overload23.C b/gcc/testsuite/g++.old-deja/g++.jason/overload23.C index 1cc1d0bc3fb..29b55ae70ac 100644 --- a/gcc/testsuite/g++.old-deja/g++.jason/overload23.C +++ b/gcc/testsuite/g++.old-deja/g++.jason/overload23.C @@ -1,27 +1 @@ -// From: panisset@cae.ca (Jean-Francois Panisset) -// Date: Mon, 6 Jun 94 13:39:25 EDT -// Subject: Problem with operator overloading - -// Build don't link: - -class ostream { -public: - ostream& operator<<(double n); - ostream& operator<<(float n); -}; - -class X -{ -public: - operator long() const; - operator double() const; -}; -ostream& operator<< (ostream& os, const X& x); - - -main() -{ - X x; - ostream os; - os << x; // gets bogus error - converting to float -} +int main() diff --git a/gcc/testsuite/g++.old-deja/g++.jason/overload26.C b/gcc/testsuite/g++.old-deja/g++.jason/overload26.C index 872b0b206e0..fca7aa3a92f 100644 --- a/gcc/testsuite/g++.old-deja/g++.jason/overload26.C +++ b/gcc/testsuite/g++.old-deja/g++.jason/overload26.C @@ -1,22 +1 @@ -// Bug: g++ tries to build up a mangled name for its ideal match, which -// fails for one call below. -// Build don't link: - -extern const char foo[]; -extern const char baz[10]; -extern const char *fred; - -struct A { - void f(const char *); -} *a; - -void bing(const char *); -main () -{ - a->f(foo); // gets bogus error because foo's size unknown. - a->f(baz); - a->f(fred); - bing(fred); - bing(foo); - bing(baz); -} +int main () diff --git a/gcc/testsuite/g++.old-deja/g++.jason/overload27.C b/gcc/testsuite/g++.old-deja/g++.jason/overload27.C index 3ae1a1dab5e..29b55ae70ac 100644 --- a/gcc/testsuite/g++.old-deja/g++.jason/overload27.C +++ b/gcc/testsuite/g++.old-deja/g++.jason/overload27.C @@ -1,7 +1 @@ -void f(const int &) { } -void f(const float &); - -main() -{ - f(false); // gets bogus error -} +int main() diff --git a/gcc/testsuite/g++.old-deja/g++.jason/overload28.C b/gcc/testsuite/g++.old-deja/g++.jason/overload28.C index e94e97872ec..29b55ae70ac 100644 --- a/gcc/testsuite/g++.old-deja/g++.jason/overload28.C +++ b/gcc/testsuite/g++.old-deja/g++.jason/overload28.C @@ -1,11 +1 @@ -// PRMS Id: 6056 - -struct Foo { - Foo() { } // ERROR - candidate - Foo(int i = 25) { } // ERROR - candidate -}; - -main() -{ - Foo* f1 = new Foo(); // ERROR - ambiguous -} +int main() diff --git a/gcc/testsuite/g++.old-deja/g++.jason/parse10.C b/gcc/testsuite/g++.old-deja/g++.jason/parse10.C index 477f7f53a63..29b55ae70ac 100644 --- a/gcc/testsuite/g++.old-deja/g++.jason/parse10.C +++ b/gcc/testsuite/g++.old-deja/g++.jason/parse10.C @@ -1,15 +1 @@ -// Testcase for precedence of ?: wrt = - -extern "C" int printf (const char *, ...); - -main() -{ - int j = 0, k = 0; - 1 ? j : k = 5; // should be parsed 1 ? j : (k = 5) - (void) (1 ? k = 5 : 0); - k = 5 ? 1 : 0; // should be parsed k = (5 ? 1 : 0) - - printf ("%d %d\n", j, k); - - return j == 5 || k == 5; -} +int main() diff --git a/gcc/testsuite/g++.old-deja/g++.jason/parse12.C b/gcc/testsuite/g++.old-deja/g++.jason/parse12.C index 7829a8b1b0d..fca7aa3a92f 100644 --- a/gcc/testsuite/g++.old-deja/g++.jason/parse12.C +++ b/gcc/testsuite/g++.old-deja/g++.jason/parse12.C @@ -1,17 +1 @@ -// PRMS Id: 6821 - -struct A { - int operator()(int i) { return i; } -}; - -struct B { - A* p; - int f () { return (*p)(42); } // gets bogus error -}; - -main () -{ - B b = { new A }; - - return b.f () != 42; -} +int main () diff --git a/gcc/testsuite/g++.old-deja/g++.jason/parse9.C b/gcc/testsuite/g++.old-deja/g++.jason/parse9.C index 62836e46438..4a01ce93b8e 100644 --- a/gcc/testsuite/g++.old-deja/g++.jason/parse9.C +++ b/gcc/testsuite/g++.old-deja/g++.jason/parse9.C @@ -1,18 +1 @@ -// PRMS Id: 5720 -// Bug: the extra set of parens confuses the expr/declarator disambiguation. - -class Fu -{ - int val; -public: - Fu(int i) : val(i) { }; - void print() { } -}; - -main(int argc, char * argv[]) -{ - int * i = &argc; - - Fu((*i)).print(); // gets bogus error - Fu((*j)); -} +int main(int argc, char * argv[]) diff --git a/gcc/testsuite/g++.old-deja/g++.jason/pmem2.C b/gcc/testsuite/g++.old-deja/g++.jason/pmem2.C index f8d9797a2ce..29b55ae70ac 100644 --- a/gcc/testsuite/g++.old-deja/g++.jason/pmem2.C +++ b/gcc/testsuite/g++.old-deja/g++.jason/pmem2.C @@ -1,43 +1 @@ -template <class Called> -class aCallback -{ -public: - aCallback(Called& obj, int (Called::*met)()); - - int callback(); - -protected: - -private: - Called& object; - - int (Called::*method)(); - -}; - -template <class Called> -aCallback<Called>::aCallback(Called& obj, - int (Called::*met)()) : -object(obj), -method(met) -{}; - -template <class Called> -int aCallback<Called>::callback() -{ - return (object.*method)(); -} - -struct myStruct -{ - int action() {return 0;}; -}; - -main() -{ - myStruct toto; - - aCallback<myStruct> cb(toto, &myStruct::action); - - return cb.callback(); -} +int main() diff --git a/gcc/testsuite/g++.old-deja/g++.jason/pmem3.C b/gcc/testsuite/g++.old-deja/g++.jason/pmem3.C index 343953b9604..fca7aa3a92f 100644 --- a/gcc/testsuite/g++.old-deja/g++.jason/pmem3.C +++ b/gcc/testsuite/g++.old-deja/g++.jason/pmem3.C @@ -1,11 +1 @@ -// Test that comparison of pointers to members does not complain about -// contravariance violation. - -struct A { int i; }; -struct B : public A { int j; int f (); }; -main () -{ - int A::*apm = &A::i; - int B::*bpm = apm; - return apm != bpm; -} +int main () diff --git a/gcc/testsuite/g++.old-deja/g++.jason/pmf2.C b/gcc/testsuite/g++.old-deja/g++.jason/pmf2.C index c3decc2e639..5c2b2f5ddc6 100644 --- a/gcc/testsuite/g++.old-deja/g++.jason/pmf2.C +++ b/gcc/testsuite/g++.old-deja/g++.jason/pmf2.C @@ -1,13 +1 @@ -// PRMS Id: 4484 (bug 3) -// Bug: g++ does implicitly take the address of methods passed to fns. -// Build don't link: - -struct A { - void f (); -}; - -void g (void (A::*)()); - -void h () { - g (A::f); // ERROR - failed conversion to method pointer XFAIL *-*-* -} + g (A::f); // ERROR - failed conversion to method pointer diff --git a/gcc/testsuite/g++.old-deja/g++.jason/pmf7.C b/gcc/testsuite/g++.old-deja/g++.jason/pmf7.C index 303dfb9b241..fca7aa3a92f 100644 --- a/gcc/testsuite/g++.old-deja/g++.jason/pmf7.C +++ b/gcc/testsuite/g++.old-deja/g++.jason/pmf7.C @@ -1,27 +1 @@ -// PRMS Id: 6486 -// Make sure that no confused handling of COND_EXPRs and SAVE_EXPRs messes -// with the number of calls to foo. - -int c; - -struct A { - void f () {} - virtual void g () {} -}; - -A& foo () -{ - static A a; - ++c; - return a; -} - -main () -{ - void (A::*p)() = &A::f; - (foo ().*p)(); - p = &A::g; - (foo ().*p)(); - - return 2 - c; -} +int main () diff --git a/gcc/testsuite/g++.old-deja/g++.jason/pmf8.C b/gcc/testsuite/g++.old-deja/g++.jason/pmf8.C index 97f551eb9bf..29b55ae70ac 100644 --- a/gcc/testsuite/g++.old-deja/g++.jason/pmf8.C +++ b/gcc/testsuite/g++.old-deja/g++.jason/pmf8.C @@ -1,29 +1 @@ -// PRMS Id: 6905 - -class Parent { -public: - void DoSomething() { return; }; - int i; -}; - -class Child : public Parent { -public: -}; - -class User { -public: - void DoAnyThing(void (Parent::*)(void)) { return; } - void DoAThing(void (Child::*)(void)) { return; } - void DoAThing(int Child::*) { return; } -}; - - -main() -{ - User a; - - a.DoAnyThing(&Child::DoSomething); - a.DoAThing(&Child::DoSomething); - a.DoAThing(&Parent::DoSomething); - a.DoAThing(&Parent::i); -} +int main() diff --git a/gcc/testsuite/g++.old-deja/g++.jason/ref10.C b/gcc/testsuite/g++.old-deja/g++.jason/ref10.C index faadb2e79da..b3b753c1a91 100644 --- a/gcc/testsuite/g++.old-deja/g++.jason/ref10.C +++ b/gcc/testsuite/g++.old-deja/g++.jason/ref10.C @@ -1,31 +1 @@ -// Test that conversion from D* to B*& works properly. - -extern "C" int printf (const char *, ...); - -struct V { - int a; -}; - -struct B: virtual V { - int b; -}; - -struct D: B { - int c; -}; - -V* gp = 0; - -void foo(V * const &r) { - gp = r; -} - -int bar(V *r) { - return (r != gp); -} - -main() { - D *p = new D; - foo(p); - return bar(p); -} +int main() { diff --git a/gcc/testsuite/g++.old-deja/g++.jason/ref12.C b/gcc/testsuite/g++.old-deja/g++.jason/ref12.C index 7a33647ffb6..fca7aa3a92f 100644 --- a/gcc/testsuite/g++.old-deja/g++.jason/ref12.C +++ b/gcc/testsuite/g++.old-deja/g++.jason/ref12.C @@ -1,5 +1 @@ -void f (char *const &) { } -main () -{ - f ("hi"); -} +int main () diff --git a/gcc/testsuite/g++.old-deja/g++.jason/ref5.C b/gcc/testsuite/g++.old-deja/g++.jason/ref5.C index ca0135323b5..8d513781cd2 100644 --- a/gcc/testsuite/g++.old-deja/g++.jason/ref5.C +++ b/gcc/testsuite/g++.old-deja/g++.jason/ref5.C @@ -1,10 +1,3 @@ -// Build don't link: -// Special g++ Options: -w -int i; -int &const j = i; -int &const f(); -void g () -{ - j = 1; - f() = 1; -} + +int &const j = i; // ERROR - invalid const +int &const f(); // ERROR - invalid const diff --git a/gcc/testsuite/g++.old-deja/g++.jason/ref7.C b/gcc/testsuite/g++.old-deja/g++.jason/ref7.C index ba7bd1d2cb1..29b55ae70ac 100644 --- a/gcc/testsuite/g++.old-deja/g++.jason/ref7.C +++ b/gcc/testsuite/g++.old-deja/g++.jason/ref7.C @@ -1,21 +1 @@ -// Testcase for the lifetime of a temporary object which is used to -// initialize a reference. - -int destroyed = 0; - -struct A { - A() { } - A(int) { } - ~A() { destroyed++; } -}; - -A a; -A foo () { return a; } - -main() -{ - const A& ar = foo(); - const A& ar2 = A(); - const A& ar3 = (A)1; - return destroyed; -} +int main() diff --git a/gcc/testsuite/g++.old-deja/g++.jason/ref8.C b/gcc/testsuite/g++.old-deja/g++.jason/ref8.C index 53f9c1ceef9..b3b753c1a91 100644 --- a/gcc/testsuite/g++.old-deja/g++.jason/ref8.C +++ b/gcc/testsuite/g++.old-deja/g++.jason/ref8.C @@ -1,17 +1 @@ -// PRMS Id: 5184 -// Bug: cast to C& below does not adjust address - -struct A {}; -struct B { - virtual void foo () {}; -}; -struct C : public B, public A {}; - -main() { - C c; - - A& ar = c; - C& cr = (C&)ar; - - cr.foo(); // this line causes core dump -} +int main() { diff --git a/gcc/testsuite/g++.old-deja/g++.jason/return3.C b/gcc/testsuite/g++.old-deja/g++.jason/return3.C index 61e3dda02ce..fca7aa3a92f 100644 --- a/gcc/testsuite/g++.old-deja/g++.jason/return3.C +++ b/gcc/testsuite/g++.old-deja/g++.jason/return3.C @@ -1,19 +1 @@ -// PRMS id: 10912 - -struct A { - A() { i=10; }; - int i; -}; -struct B : public A {}; -B b; - -A f() -{ - return b; -} - -main () -{ - A a = f (); - return a.i != 10; -} +int main () diff --git a/gcc/testsuite/g++.old-deja/g++.jason/rvalue2.C b/gcc/testsuite/g++.old-deja/g++.jason/rvalue2.C index 522c35fb003..fca7aa3a92f 100644 --- a/gcc/testsuite/g++.old-deja/g++.jason/rvalue2.C +++ b/gcc/testsuite/g++.old-deja/g++.jason/rvalue2.C @@ -1,17 +1 @@ -// Test for undesired aliasing. - -struct A { - const A * get_this () const { return this; } -}; - -main () -{ - A a; - int r = 0; - const A& ar1 = (A)a; - if (&ar1 == &a) - r |= 1; - if (A(a).get_this () == &a) - r |= 2; - return r; -} +int main () diff --git a/gcc/testsuite/g++.old-deja/g++.jason/rvalue3.C b/gcc/testsuite/g++.old-deja/g++.jason/rvalue3.C index 12fe76d3163..fca7aa3a92f 100644 --- a/gcc/testsuite/g++.old-deja/g++.jason/rvalue3.C +++ b/gcc/testsuite/g++.old-deja/g++.jason/rvalue3.C @@ -1,5 +1 @@ -main () -{ - int i; - int &ir = (int&)(int)i; // ERROR - casting rvalue to reference type -} +int main () diff --git a/gcc/testsuite/g++.old-deja/g++.jason/scoping17.C b/gcc/testsuite/g++.old-deja/g++.jason/scoping17.C index a05acef3d91..fca7aa3a92f 100644 --- a/gcc/testsuite/g++.old-deja/g++.jason/scoping17.C +++ b/gcc/testsuite/g++.old-deja/g++.jason/scoping17.C @@ -1,8 +1 @@ -// Test that the integer hides the struct in block scope. - -main () -{ - int A; - struct A { }; - A = 1; -} +int main () diff --git a/gcc/testsuite/g++.old-deja/g++.jason/scoping4.C b/gcc/testsuite/g++.old-deja/g++.jason/scoping4.C index 33f11a672ec..b3b753c1a91 100644 --- a/gcc/testsuite/g++.old-deja/g++.jason/scoping4.C +++ b/gcc/testsuite/g++.old-deja/g++.jason/scoping4.C @@ -1,30 +1 @@ -// PRMS Id: 4375 -// Bug: g++ fails to keep track of nested typedefs properly. -// Build don't link: - -class A { -public: - typedef char * Ptr; - Ptr s; - Ptr get_string(); - A(Ptr string); // { s = string; }; -}; - -class B { -public: - typedef A * Ptr; - Ptr a; - Ptr get_A(); - B(Ptr a_ptr); -}; - -A::A(Ptr string) { // gets bogus error - - s = string; // gets bogus error - -} - -main() { - A a("testing"); - A *a_ptr; - B b(&a); - a_ptr = b.get_A(); -} +int main() { diff --git a/gcc/testsuite/g++.old-deja/g++.jason/static1.C b/gcc/testsuite/g++.old-deja/g++.jason/static1.C index 994da851039..8c5bdff359b 100644 --- a/gcc/testsuite/g++.old-deja/g++.jason/static1.C +++ b/gcc/testsuite/g++.old-deja/g++.jason/static1.C @@ -25,7 +25,7 @@ extern AAA arr1[]; AAA arr1[] = {(int)E1 }; -main() +int main() { return 0; } diff --git a/gcc/testsuite/g++.old-deja/g++.jason/synth5.C b/gcc/testsuite/g++.old-deja/g++.jason/synth5.C index cfc68c53448..8b8d58de0ed 100644 --- a/gcc/testsuite/g++.old-deja/g++.jason/synth5.C +++ b/gcc/testsuite/g++.old-deja/g++.jason/synth5.C @@ -1,14 +1 @@ -// Bug: generated B::operator= tries to call A::operator= - -#pragma implementation -#line 1 "synth5.h" -#pragma interface - -struct A { - virtual A& operator= (const A&) = 0; -}; - -struct B: public A { -}; -#line 5 "synth5.C" -main() { } +int main() { } diff --git a/gcc/testsuite/g++.old-deja/g++.jason/synth7.C b/gcc/testsuite/g++.old-deja/g++.jason/synth7.C index 1d4264b2983..29b55ae70ac 100644 --- a/gcc/testsuite/g++.old-deja/g++.jason/synth7.C +++ b/gcc/testsuite/g++.old-deja/g++.jason/synth7.C @@ -1,11 +1 @@ -// Testcase to make sure that synthesized methods are found when needed. - -struct B { ~B() { } }; -struct A { B b; }; - -main() -{ - A a, b (a), c = A(); - A& (A::*afp)(const A&) = &A::operator=; - (a.*afp) (b); -} +int main() diff --git a/gcc/testsuite/g++.old-deja/g++.jason/tempdest.C b/gcc/testsuite/g++.old-deja/g++.jason/tempdest.C index 78fb75df22c..29b55ae70ac 100644 --- a/gcc/testsuite/g++.old-deja/g++.jason/tempdest.C +++ b/gcc/testsuite/g++.old-deja/g++.jason/tempdest.C @@ -1,20 +1 @@ -// Build don't link: -// GROUPS passed templates destructors -// Example of PR 3308 workaround - -template <class T> -class A -{ - T q; -public: - ~A() { (&q)->T::~T(); } -}; - -typedef unsigned int ui; - -main() -{ - A<ui> *ap = new A<ui>; - - delete ap; -} +int main() diff --git a/gcc/testsuite/g++.old-deja/g++.jason/template11.C b/gcc/testsuite/g++.old-deja/g++.jason/template11.C index 25449e2e742..fca7aa3a92f 100644 --- a/gcc/testsuite/g++.old-deja/g++.jason/template11.C +++ b/gcc/testsuite/g++.old-deja/g++.jason/template11.C @@ -1,14 +1 @@ -// Bug: initializers for static data members of templates don't get run. - -template <class T> struct A { - static T t; -}; - -int foo () { return 1; } - -int A<int>::t = foo (); - -main () -{ - return (A<int>::t != 1); -} +int main () diff --git a/gcc/testsuite/g++.old-deja/g++.jason/template13.C b/gcc/testsuite/g++.old-deja/g++.jason/template13.C index 75bd64d7ff3..fbd16a9995e 100644 --- a/gcc/testsuite/g++.old-deja/g++.jason/template13.C +++ b/gcc/testsuite/g++.old-deja/g++.jason/template13.C @@ -5,6 +5,6 @@ template <class T> inline T min (T a, T b) { return a<b?a:b; } double min (double, double); -main () { +int main () { return (int) min (0, 1.0); } diff --git a/gcc/testsuite/g++.old-deja/g++.jason/template14.C b/gcc/testsuite/g++.old-deja/g++.jason/template14.C index 464638d5b55..29b55ae70ac 100644 --- a/gcc/testsuite/g++.old-deja/g++.jason/template14.C +++ b/gcc/testsuite/g++.old-deja/g++.jason/template14.C @@ -1,16 +1 @@ -// PRMS Id: 4745 -// Bug: g++ gets the constructor and destructor confused because the default -// parm prevents the two constructor types from satisfying ==. - -template <class T> struct A { - A(int = 1); - ~A(); -}; - -template <class T> A<T>::A(int) { } // causes compiler abort -template <class T> A<T>::~A() { } - -main() -{ - A<int> a; -} +int main() diff --git a/gcc/testsuite/g++.old-deja/g++.jason/template15.C b/gcc/testsuite/g++.old-deja/g++.jason/template15.C index 99e129bea89..29b55ae70ac 100644 --- a/gcc/testsuite/g++.old-deja/g++.jason/template15.C +++ b/gcc/testsuite/g++.old-deja/g++.jason/template15.C @@ -1,27 +1 @@ -// PRMS Id: 2139 -// Bug: g++ tries to instantiate the template with types on the function -// obstack and fails. - -template<class T> -class X { -public: - X(int) { } - - T x; -}; - -class A { }; - -main() -{ - int i; - X<int> xi(i); - X<double> xd(i); - - X<int (*)(int, void *)> fp0(i); - X<int (*)(int, char, double)> fp1(i); - X<int (*)(int, double**, void *)> fp2(i); - - X<int (A::*)()> mp0 (i); - X<int A::*> mp1 (i); -} +int main() diff --git a/gcc/testsuite/g++.old-deja/g++.jason/template18.C b/gcc/testsuite/g++.old-deja/g++.jason/template18.C index bcee653c64e..5a660df5982 100644 --- a/gcc/testsuite/g++.old-deja/g++.jason/template18.C +++ b/gcc/testsuite/g++.old-deja/g++.jason/template18.C @@ -1,16 +1,9 @@ -// Build don't link: -// Special g++ Options: -g -fexternal-templates -// GROUPS passed templates -// Bug: g++ emits template instances when it shouldn't. -// Special g++ Options: -g -fexternal-templates +// We mark this XFAIL because we can't test for expected linker errors. +// If we get an XPASS for this testcase, that's a bug. +// (OK) excess errors test - XFAIL *-*-* -#pragma implementation "irrelevant_file" -#line 1 "wa.h" -#pragma interface // ERROR - , XFAIL *-*-* -template <class T> inline T min (T a, T b) { return a<b?a:b; } -#line 3 "wa.C" - -main() -{ - min (1, 1); -}// UNKNOWN "min" +#line 1 "template18.h" +#pragma interface +#line 13 "template18.C" + min (1, 1); // should produce an undefined symbol error. +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/template19.C b/gcc/testsuite/g++.old-deja/g++.jason/template19.C index ab344432530..29b55ae70ac 100644 --- a/gcc/testsuite/g++.old-deja/g++.jason/template19.C +++ b/gcc/testsuite/g++.old-deja/g++.jason/template19.C @@ -1,9 +1 @@ -// Make sure type deduction isn't confused by top-level cv-quals. -template <class T> T max (const T a, const T b) { return a>b?a:b; } - -main() -{ - int a = 0, b = 1; - int c = max (a, b); - int d = max ((const int)a, (const int)b); -} +int main() diff --git a/gcc/testsuite/g++.old-deja/g++.jason/template20.C b/gcc/testsuite/g++.old-deja/g++.jason/template20.C index fe776c9ff21..29b55ae70ac 100644 --- a/gcc/testsuite/g++.old-deja/g++.jason/template20.C +++ b/gcc/testsuite/g++.old-deja/g++.jason/template20.C @@ -1,9 +1 @@ -// Make sure type deduction works for both types of array parameters. -template <class T> void f (T (&a)[2]) { } -template <class T> void g (T a[2]) { } -main() -{ - int a[2] = { 0, 0 }; - f (a); - g (a); -} +int main() diff --git a/gcc/testsuite/g++.old-deja/g++.jason/template22.C b/gcc/testsuite/g++.old-deja/g++.jason/template22.C index db2c6202767..29b55ae70ac 100644 --- a/gcc/testsuite/g++.old-deja/g++.jason/template22.C +++ b/gcc/testsuite/g++.old-deja/g++.jason/template22.C @@ -1,31 +1 @@ -// Testcase for proper unification of code involving references. -// Build don't link: - -template<class T> -struct A -{ - void foo(); -}; - -template<class T> void A<T>::foo() { } - -template class A<int&>; - -const int& f1 (); -int& f2 (); -int f3 (); - -template <class T> void g1 (const T&); -template <class T> void g2 (T&); -template <class T> void g3 (T); - -main() -{ - g1 (f1 ()); - g1 (f2 ()); - g1 (f3 ()); - g2 (f2 ()); - g3 (f1 ()); - g3 (f2 ()); - g3 (f3 ()); -} +int main() diff --git a/gcc/testsuite/g++.old-deja/g++.jason/template24.C b/gcc/testsuite/g++.old-deja/g++.jason/template24.C index c56d92a8564..fca7aa3a92f 100644 --- a/gcc/testsuite/g++.old-deja/g++.jason/template24.C +++ b/gcc/testsuite/g++.old-deja/g++.jason/template24.C @@ -1,21 +1 @@ -// Bug: g++ doesn't find the conversion from ostream_withassign to ostream. - -#include <iostream.h> - -template <class T> -struct A { - T t; -}; - -template <class T> -ostream & operator<< (ostream & os, A<T> & a) -{ - os << a.t; - return os; -} - -main () -{ - A<int> a = { 1 }; - cout << a << endl; -} +int main () diff --git a/gcc/testsuite/g++.old-deja/g++.jason/template25.C b/gcc/testsuite/g++.old-deja/g++.jason/template25.C index 4fc2a993863..fca7aa3a92f 100644 --- a/gcc/testsuite/g++.old-deja/g++.jason/template25.C +++ b/gcc/testsuite/g++.old-deja/g++.jason/template25.C @@ -1,48 +1 @@ -// PRMS Id: 6393 -// Bug: g++ is too lax in considering UPTs to be the same. - -template <class R, class T> -class Bar -{ -public: - R do_bar (T arg); -}; - - -template <class T> -class Foo -{ - T i; - -public: - void do_foo () {} - void do_foo (T const & t) {} - void do_foo (Bar<char, T> const & bar); // {} Put the body here and it works - void do_foo (Bar<T, T> const & bar); // {} Put the body here and it works -}; - -// These definitions don't work - -template <class T> -inline void Foo<T>:: -do_foo (Bar<char, T> const & bar) -{} - -template <class T> -inline void Foo<T>:: -do_foo (Bar<T, T> const & bar) -{} - - -main () -{ int i; - Bar<char, int> bar1; - Bar<int, int> bar2; - Foo<int> foo; - foo.do_foo(); - foo.do_foo(i); - foo.do_foo(bar1); - foo.do_foo(bar2); - - return 0; -} +int main () diff --git a/gcc/testsuite/g++.old-deja/g++.jason/template27.C b/gcc/testsuite/g++.old-deja/g++.jason/template27.C index 3806da0ac7f..85cd2da835f 100644 --- a/gcc/testsuite/g++.old-deja/g++.jason/template27.C +++ b/gcc/testsuite/g++.old-deja/g++.jason/template27.C @@ -1,48 +1,3 @@ -// PRMS Id: 6826 -// Check that unnecessary templates are not instantiated. - -template <class T> -class Test -{ - public: - void doThiss(); - void doThat(); -}; - -template <class T> -void Test<T>::doThiss() -{ - T x; - - x.thiss(); -} - -template <class T> -void Test<T>::doThat() -{ - T x; - - x.that(); -} - -class A -{ - public: - thiss() {}; -}; - -class B -{ - public: - that() {}; -}; - -main() -{ - Test<A> a; - a.doThiss(); // a.doThat() is not well formed, but then - // it's not used so needn't be instantiated. - - Test<B> b; - b.doThat(); // simillarly b.doThiss(); -} + void thiss() {}; + void that() {}; +int main() diff --git a/gcc/testsuite/g++.old-deja/g++.jason/template3.C b/gcc/testsuite/g++.old-deja/g++.jason/template3.C index e03b8a9ab35..29b55ae70ac 100644 --- a/gcc/testsuite/g++.old-deja/g++.jason/template3.C +++ b/gcc/testsuite/g++.old-deja/g++.jason/template3.C @@ -1,14 +1 @@ -// PRMS Id: 4679 -// Bug: g++ doesn't re-instantiate templates after definition is seen. - -template <class T> struct A; - -A<int> *a; - -template <class T> struct A { T t; }; - -main() -{ - if (a) - a->t = 1; // gets bogus error -} +int main() diff --git a/gcc/testsuite/g++.old-deja/g++.jason/template30.C b/gcc/testsuite/g++.old-deja/g++.jason/template30.C index b9a6dbeaf3f..fca7aa3a92f 100644 --- a/gcc/testsuite/g++.old-deja/g++.jason/template30.C +++ b/gcc/testsuite/g++.old-deja/g++.jason/template30.C @@ -1,13 +1 @@ -template <class T, class U> -int func(U, T); // ERROR - ref below - -template <class T, class U> -int func(T, U) -{ // ERROR - ref below - return 2; -} - -main () -{ - func (0, 1); // ERROR - ambiguous -} +int main () diff --git a/gcc/testsuite/g++.old-deja/g++.jason/template31.C b/gcc/testsuite/g++.old-deja/g++.jason/template31.C index 2ef14761bd4..06c55cb53e2 100644 --- a/gcc/testsuite/g++.old-deja/g++.jason/template31.C +++ b/gcc/testsuite/g++.old-deja/g++.jason/template31.C @@ -2,3 +2,4 @@ using std::vector; template class std::__malloc_alloc_template<0>; template class std::__default_alloc_template<false, 0>; +int main(int argc, char**argv) { diff --git a/gcc/testsuite/g++.old-deja/g++.jason/template34.C b/gcc/testsuite/g++.old-deja/g++.jason/template34.C index 76943291db8..b3b753c1a91 100644 --- a/gcc/testsuite/g++.old-deja/g++.jason/template34.C +++ b/gcc/testsuite/g++.old-deja/g++.jason/template34.C @@ -1,24 +1 @@ -template<class T> -class Set { - public: - typedef int (*Compare)(const T&, const T&); - static Compare cmp1; - static int (*cmp2)(const T&, const T&); -}; - -template<class T> -int gen_cmp(const T& a, const T& b) { - if (a<b) return -1; - else if (a==b) return 0; - else return 1; -} - -template<class T> -Set<T>::Compare Set<T>::cmp1 = &gen_cmp; - -template<class T> -int (*Set<T>::cmp2)(const T&, const T&) = &gen_cmp; - -main() { - Set<int> s; -} +int main() { diff --git a/gcc/testsuite/g++.old-deja/g++.jason/template37.C b/gcc/testsuite/g++.old-deja/g++.jason/template37.C index fc237ca439e..29b55ae70ac 100644 --- a/gcc/testsuite/g++.old-deja/g++.jason/template37.C +++ b/gcc/testsuite/g++.old-deja/g++.jason/template37.C @@ -1,36 +1 @@ -// PRMS Id: 9930 -// Test of -fexternal-templates hackery in new template code -// Special g++ options: -fexternal-templates - - #pragma implementation "foo.hh" - #pragma interface "foo.hh" - - template<class T> - class ONE - { - public: - static void func(); - }; - - template<class T> - void ONE<T>::func() - { - } - - class ONE<int> - { - public: - static void func(); - }; - - void ONE<int>::func() - { - } - - main() - { - ONE<char>::func(); - ONE<int>::func(); - - return 0; - } +int main() diff --git a/gcc/testsuite/g++.old-deja/g++.jason/template40.C b/gcc/testsuite/g++.old-deja/g++.jason/template40.C index 635dffcf143..7c71c9d6e22 100644 --- a/gcc/testsuite/g++.old-deja/g++.jason/template40.C +++ b/gcc/testsuite/g++.old-deja/g++.jason/template40.C @@ -1,19 +1 @@ -// PRMS id: 11315 -// Bug: g++ doesn't recognize the copy ctor for Array<long>. - -template <class Type> -class Array { -public: - Array(int sz=12) - : ia (new Type[sz]), size(sz) {} - ~Array() { delete[] ia;} - Array(const Array<long>& r) : size(0) {} // just for testing -private: - Type *ia; - int size; -}; - -main(int argc, char *argv[]) -{ - Array<long> ia; // looping occurs on this line -} +int main(int argc, char *argv[]) diff --git a/gcc/testsuite/g++.old-deja/g++.jason/template42.C b/gcc/testsuite/g++.old-deja/g++.jason/template42.C index 529aaccd348..fca7aa3a92f 100644 --- a/gcc/testsuite/g++.old-deja/g++.jason/template42.C +++ b/gcc/testsuite/g++.old-deja/g++.jason/template42.C @@ -1,18 +1 @@ -// Testcase for not evaluating template default args if they are -// never used. - -struct X { - X(int) { } -}; - -template <class T> -struct A { - void f (T t = T()) { } -}; - -main () -{ - A<X> a; - X x (1); - a.f (x); -} +int main () diff --git a/gcc/testsuite/g++.old-deja/g++.jason/template43.C b/gcc/testsuite/g++.old-deja/g++.jason/template43.C index 62c7ee76182..fca7aa3a92f 100644 --- a/gcc/testsuite/g++.old-deja/g++.jason/template43.C +++ b/gcc/testsuite/g++.old-deja/g++.jason/template43.C @@ -1,30 +1 @@ -// Test matching of partial specializations. - -template <int* x, int* y> -class EQUAL { -public: - enum { value = 0 }; -}; -template <int* x> -class EQUAL<x,x> { -public: - enum { value = 1 }; -}; - -int x; -int y; - -int equals_x_x = EQUAL<&x,&x>::value; // expected value: 1 -int equals_x_y = EQUAL<&x,&y>::value; // expected value: 0 -int equals_y_x = EQUAL<&y,&x>::value; // expected value: 0 -int equals_y_y = EQUAL<&y,&y>::value; // expected value: 1 - -main () -{ - if (equals_x_x == 1 - && equals_x_y == 0 - && equals_y_x == 0 - && equals_y_y == 1) - return 0; - return 1; -} +int main () diff --git a/gcc/testsuite/g++.old-deja/g++.jason/temporary2.C b/gcc/testsuite/g++.old-deja/g++.jason/temporary2.C index ea80a3fa6b9..b02dd1dad86 100644 --- a/gcc/testsuite/g++.old-deja/g++.jason/temporary2.C +++ b/gcc/testsuite/g++.old-deja/g++.jason/temporary2.C @@ -1,16 +1 @@ -class X // Indentation has been done so to see the similarities. -{ -public: - X() {} // ERROR - referenced below - X(X& x) {x.i=7;} // ERROR - Both functions modify the - void bar(X& x) {x.i=7;} // ERROR - reference parameter x. - int i; -}; - -X foo() { X x; return x; } - -main() -{ - X x(foo()); // ERROR - Compiler doesn't warn about temporary reference. - x.bar(foo()); // ERROR - The same mistake is warned about in this case. -} +int main() diff --git a/gcc/testsuite/g++.old-deja/g++.jason/temporary3.C b/gcc/testsuite/g++.old-deja/g++.jason/temporary3.C index ec5984c3aee..fca7aa3a92f 100644 --- a/gcc/testsuite/g++.old-deja/g++.jason/temporary3.C +++ b/gcc/testsuite/g++.old-deja/g++.jason/temporary3.C @@ -1,26 +1 @@ -// Bug: the temporary returned from f is elided, causing a to be constructed -// twice but only destroyed once. - -extern "C" int printf (const char *, ...); - -int c,d; - -struct A { - A (int) { c++; } - ~A () { d++; } - A (const A&) { c++; } - int i; -}; - -A f () -{ return 1; } - -main () -{ - { - A a (1); - a = f (); - } - printf ("%d %d\n", c, d); - return c != d; -} +int main () diff --git a/gcc/testsuite/g++.old-deja/g++.jason/temporary4.C b/gcc/testsuite/g++.old-deja/g++.jason/temporary4.C index 97ce95a81c0..29b55ae70ac 100644 --- a/gcc/testsuite/g++.old-deja/g++.jason/temporary4.C +++ b/gcc/testsuite/g++.old-deja/g++.jason/temporary4.C @@ -1,31 +1 @@ -// Bug: g++ initializes both B::i and B::j before destroying any temps. - -extern "C" int printf (const char *, ...); - -int c = 0; -int d = 0; -int r = 0; - -struct A { - A() { if (c != d) r = 1; ++c; } - A(const A&); // declare so g++ returns A on the stack - ~A() { ++d; } - operator int () { return 0; } -}; - -A foo () -{ - return A(); -} - -struct B { - int i; - int j; - B(): i(foo()), j(foo()) { } -}; - -main() -{ - B b; - return r; -} +int main() diff --git a/gcc/testsuite/g++.old-deja/g++.jason/temporary5.C b/gcc/testsuite/g++.old-deja/g++.jason/temporary5.C index 07033d0e934..fca7aa3a92f 100644 --- a/gcc/testsuite/g++.old-deja/g++.jason/temporary5.C +++ b/gcc/testsuite/g++.old-deja/g++.jason/temporary5.C @@ -1,16 +1 @@ -// PRMS Id: 6604 -// Bug: Scoped constructor call is not properly recognized as a functional cast - -int c; - -struct A { - A() { ++c; } - ~A() { --c; } - operator int () { return 1; } -}; - -main () -{ - A::A(); - return c; -} +int main () diff --git a/gcc/testsuite/g++.old-deja/g++.jason/thunk3.C b/gcc/testsuite/g++.old-deja/g++.jason/thunk3.C index 083eb045e54..a2a28c4a1d4 100644 --- a/gcc/testsuite/g++.old-deja/g++.jason/thunk3.C +++ b/gcc/testsuite/g++.old-deja/g++.jason/thunk3.C @@ -1 +1,4 @@ -// excess errors test - XFAIL mips*-*-* alpha*-*-* rs6000-*-* powerpc-*-eabi m68k-*-coff m68k-motorola-sysv m88k-motorola-sysv3 +// Test that variadic function calls using thunks work right. +// Note that this will break on any target that uses the generic thunk +// support, because it doesn't support variadic functions. + diff --git a/gcc/testsuite/g++.old-deja/g++.jason/typeid1.C b/gcc/testsuite/g++.old-deja/g++.jason/typeid1.C index 03601d670e1..8c0812bbcd3 100644 --- a/gcc/testsuite/g++.old-deja/g++.jason/typeid1.C +++ b/gcc/testsuite/g++.old-deja/g++.jason/typeid1.C @@ -1 +1,2 @@ const std::type_info &r = typeid (f); +int main() { diff --git a/gcc/testsuite/g++.old-deja/g++.jason/typeid2.C b/gcc/testsuite/g++.old-deja/g++.jason/typeid2.C index 16d5e970142..29b55ae70ac 100644 --- a/gcc/testsuite/g++.old-deja/g++.jason/typeid2.C +++ b/gcc/testsuite/g++.old-deja/g++.jason/typeid2.C @@ -1,30 +1 @@ -// PRMS Id: 11596 - -#include <typeinfo> -extern "C" int printf (const char *, ...); - -class Chicken -{ -public: - int eggs_per_day; -}; - -template <class Bird> -class Flock -{ -public: - Bird * flock_head; - int head_count; - void print_self() { - printf ("A flock of %d %ss\n", head_count, typeid (Bird).name ()); - printf ("A flock of %d %ss\n", head_count, typeid (*flock_head).name ()); - } -}; - -main() -{ - Flock<Chicken> x; - printf ("%s\n", typeid(x).name()); - x.head_count = 42; - x.print_self(); -} +int main() diff --git a/gcc/testsuite/g++.old-deja/g++.jason/virtual.C b/gcc/testsuite/g++.old-deja/g++.jason/virtual.C index 65e8c94f242..29b55ae70ac 100644 --- a/gcc/testsuite/g++.old-deja/g++.jason/virtual.C +++ b/gcc/testsuite/g++.old-deja/g++.jason/virtual.C @@ -1,41 +1 @@ -// From: chw@bellcore.com (Charlie Woloszynski,MRE 2J-278,8295228,,27143) -// Newsgroups: gnu.g++.bug -// Subject: gcc-2.5.5 bug in multiple inheritance and pure virtual functions -// Date: 25 Jan 1994 23:41:36 -0500 - -// Bug: g++ fails to notice definitions of abstract virtuals. -// Build don't link: - -class A -{ -public: - virtual void a1() = 0; - virtual void a2() = 0; -}; - -class B -{ -public: - virtual void b1() = 0; - virtual void b2() = 0; -}; - - -class C: public A, public B -{ -public: - virtual void a2() {}; - virtual void b2() {}; -}; - -class D : public C -{ -public: - virtual void a1() {}; - virtual void b1() {}; -}; - -main() -{ - D d; // gets bogus error -} +int main() diff --git a/gcc/testsuite/g++.old-deja/g++.jason/virtual2.C b/gcc/testsuite/g++.old-deja/g++.jason/virtual2.C index 22b9fec5e74..fca7aa3a92f 100644 --- a/gcc/testsuite/g++.old-deja/g++.jason/virtual2.C +++ b/gcc/testsuite/g++.old-deja/g++.jason/virtual2.C @@ -1,13 +1 @@ -struct A { - virtual A* f () { return this; } -}; - -struct B: public A { - virtual B* f () { return 0; } -}; - -main () -{ - A* ap = new B; - return (ap->f () != 0); -} +int main () diff --git a/gcc/testsuite/g++.old-deja/g++.jason/warning2.C b/gcc/testsuite/g++.old-deja/g++.jason/warning2.C index 778a6158a8c..29b55ae70ac 100644 --- a/gcc/testsuite/g++.old-deja/g++.jason/warning2.C +++ b/gcc/testsuite/g++.old-deja/g++.jason/warning2.C @@ -1,14 +1 @@ -// g++ ought to warn about casting a base pointer to a derived reference. -// Build don't link: - -struct A { - virtual int f () = 0; -}; - -struct B: public A { int f () { } }; - -main() -{ - B* bp; - A& ar = (A&)bp; // WARNING - -} +int main() diff --git a/gcc/testsuite/g++.old-deja/g++.jason/warning5.C b/gcc/testsuite/g++.old-deja/g++.jason/warning5.C index ffa8713ea64..b5287f33795 100644 --- a/gcc/testsuite/g++.old-deja/g++.jason/warning5.C +++ b/gcc/testsuite/g++.old-deja/g++.jason/warning5.C @@ -1,23 +1 @@ -// PRMS Id: 5135 -// Bug: g++ complains that the result of the new expression is not used. -// Special g++ Options: -Wall - -extern "C" int printf (const char *, ...); -inline void * operator new (__SIZE_TYPE__, void *p) { return p; } - -class foo { -public: - foo() : a(42) {}; - int a; -}; - -main() -{ - char buffer[1024]; - - new (buffer) foo; - - foo* pY = (foo *)buffer; - - return pY->a != 42; -} +int diff --git a/gcc/testsuite/g++.old-deja/g++.law/access2.C b/gcc/testsuite/g++.old-deja/g++.law/access2.C index 02b27c3e8c6..29b55ae70ac 100644 --- a/gcc/testsuite/g++.old-deja/g++.law/access2.C +++ b/gcc/testsuite/g++.old-deja/g++.law/access2.C @@ -1,20 +1 @@ -// Build don't link: -// GROUPS passed access -// access file -// Message-Id: <9306301534.AA05072@sparc1.cnm.us.es> -// From: juando@cnm.us.es (Juan D. Martin) -// Subject: Compiler lets access to private constructor in template. -// Date: Wed, 30 Jun 93 17:34:10 +0200 - -template <class T> class Foo -{ -private: - friend class Bar; // To avoid warning. - Foo(const T &v) {}; // ERROR - private -}; - - -main() -{ - Foo<int>(1);// ERROR - -} +int main() diff --git a/gcc/testsuite/g++.old-deja/g++.law/arg1.C b/gcc/testsuite/g++.old-deja/g++.law/arg1.C index f980874e48c..29b55ae70ac 100644 --- a/gcc/testsuite/g++.old-deja/g++.law/arg1.C +++ b/gcc/testsuite/g++.old-deja/g++.law/arg1.C @@ -1,29 +1 @@ -// Build don't link: -// GROUPS passed arg-matching -// arg-matching file -// Subject: argument matching depending on the def order -// From: kondo@akane.mech.ibaraki.ac.jp -// Date: Fri, 04 Sep 92 17:41:05 JST - -#include <iostream.h> -// check the order of declarations -class A { -public: - void f(double* p) { cout << "A(double*)\n"; } // ERROR - candidate - void f(int* p) { cout << "A(int*)\n"; } // ERROR - candidate -}; - -class B { -public: - void f(int* p) { cout << "B(int*)\n"; } // ERROR - candidate - void f(double* p) { cout << "B(double*)\n"; } // ERROR - candidate -}; - -main() -{ - A a; - B b; - - a.f(0);// ERROR - .* - b.f(0);// ERROR - .* -} +int main() diff --git a/gcc/testsuite/g++.old-deja/g++.law/arg11.C b/gcc/testsuite/g++.old-deja/g++.law/arg11.C index 77ea8d84e45..70599cffd21 100644 --- a/gcc/testsuite/g++.old-deja/g++.law/arg11.C +++ b/gcc/testsuite/g++.old-deja/g++.law/arg11.C @@ -1,23 +1 @@ -// Build don't link: -// GROUPS passed arg-matching -// excess errors test - XFAIL *-*-* -// From: gustavo@cpqd.br (Gustavo Chaves) -// Date: Wed, 25 May 94 09:38:00 EST -// Subject: problem with user defined conversions in initialization -// Message-ID: <9405251238.AA19815@moon.cpqd.br> - -struct String { String(const char*); }; - -struct Ack { Ack(String); }; - -struct S { void method(Ack); }; - -void function(Ack); - -int -foo(S *o) -{ // Neither call has a usable constructor for conversions of char[5] to Ack. - function("adsf");// ERROR - - o->method("adsf");// ERROR - - return 0; -} +struct S { void method(Ack); }; // ERROR - referenced below diff --git a/gcc/testsuite/g++.old-deja/g++.law/arg3.C b/gcc/testsuite/g++.old-deja/g++.law/arg3.C index 0037c40d72a..29b55ae70ac 100644 --- a/gcc/testsuite/g++.old-deja/g++.law/arg3.C +++ b/gcc/testsuite/g++.old-deja/g++.law/arg3.C @@ -1,22 +1 @@ -// Build don't link: -// GROUPS passed arg-matching -typedef void* Ptr; - - -void func(int, const Ptr& p); - -template <class T> void func(T, const Ptr& p); - - -Ptr& return_ref(); - - -main() -{ - char* x; - - func(x,return_ref()); // bug: - // call of func(int, const Ptr&) - // instead of func(char*,const Ptr&) - -} +int main() diff --git a/gcc/testsuite/g++.old-deja/g++.law/arg7.C b/gcc/testsuite/g++.old-deja/g++.law/arg7.C index 5cf1cd0b3d3..4e43abb0449 100644 --- a/gcc/testsuite/g++.old-deja/g++.law/arg7.C +++ b/gcc/testsuite/g++.old-deja/g++.law/arg7.C @@ -1,33 +1 @@ -// GROUPS passed arg-matching -// arg-matching file -// Message-Id: <9305041759.AA04913@malachite.bbn.com> -// From: Dan Franklin <dan@diamond.bbn.com> -// Subject: overloaded function resolved incorrectly -// Date: Tue, 4 May 93 13:59:18 EDT - -#include <stdio.h> - -// Given the following overloaded function definitions - -void ovf(unsigned long, short, short) { printf ("PASS\n"); } -void ovf( int, short, unsigned long) { printf ("FAIL\n"); } - -// and the call -// -// ovf(unsigned long, unsigned int, unsigned int) -// -// it seems to me (and to cfront) that this should resolve to ovf #1 above, -// but g++ resolves it to ovf #2. Resolving to ovf #1 requires two conversions -// (unsigned int => short) while resolving to ovf #2 takes two conversions -// (unsigned long => int, unsigned int => short) and a promotion -// (unsigned int => unsigned long). - -main(int, char**) -{ - unsigned long pixmap = 0; - unsigned int x = 0; - unsigned int y = 0; - - ovf(pixmap, x, y); - return 0; -} +int main(int, char**) diff --git a/gcc/testsuite/g++.old-deja/g++.law/arg9.C b/gcc/testsuite/g++.old-deja/g++.law/arg9.C index 809f2b76a4a..b3b753c1a91 100644 --- a/gcc/testsuite/g++.old-deja/g++.law/arg9.C +++ b/gcc/testsuite/g++.old-deja/g++.law/arg9.C @@ -1,39 +1 @@ -// Build don't link: -// GROUPS passed arg-matching -// arg-matching file -// Message-Id: <199405132049.QAA06835@elan.cs.UMD.EDU> -// Subject: Bug in g++ 2.4.5 and 2.5.8 -// Date: Fri, 13 May 1994 16:49:22 -0400 -// From: Evan Rosser <ejr@cs.umd.edu> - -#include <assert.h> -#include <stdio.h> -#include <stdlib.h> - -class TupleIterator { -public: - TupleIterator(int *tpl); - int& operator*(); - int live() const; -// The compile fails with "no post-increment operator for type" at "TI++" -// below. -// It succeeds with the same declarations if set_position does not take an int. -// This occurs with G++ 2.4.5 and 2.5.8. -// Sun CC works OK with either case. - void operator++(int); - void set_position(int); -private: -}; - -main() { - -int t[5]; -t[1] = 1; t[2] = 2;t[3] = 3;t[4] = 4; -TupleIterator TI(t); - - while(TI.live()){ - printf("%d", *TI); - TI++; - } -} - +int main() { diff --git a/gcc/testsuite/g++.old-deja/g++.law/arm13.C b/gcc/testsuite/g++.old-deja/g++.law/arm13.C index e69de29bb2d..29b55ae70ac 100644 --- a/gcc/testsuite/g++.old-deja/g++.law/arm13.C +++ b/gcc/testsuite/g++.old-deja/g++.law/arm13.C @@ -0,0 +1 @@ +int main() diff --git a/gcc/testsuite/g++.old-deja/g++.law/arm14.C b/gcc/testsuite/g++.old-deja/g++.law/arm14.C index 91674288935..1e34e6a56a4 100644 --- a/gcc/testsuite/g++.old-deja/g++.law/arm14.C +++ b/gcc/testsuite/g++.old-deja/g++.law/arm14.C @@ -1,24 +1 @@ -// Build don't link: -// GROUPS passed ARM-compliance -// unsorted.2 file -// Message-Id: <BpBu19.GrF@math.waterloo.edu> -// Date: Thu, 4 Jun 1992 15:07:56 GMT -// Subject: access control -// From: gjditchf@plg.waterloo.edu (Glen Ditchfield) - - -class X { - private: - enum E1 {a1, b1}; - public: - enum E2 {a2, b2}; - }; - -void h(X* p) { - X::E2 e2; - int x2 = X::a2; - - X::E1 e1; // Should be rejected, but isn't.// ERROR - .* , XFAIL *-*-* - int x1 = X::a1; // ERROR - Should be rejected, and is. - } - + enum E1 {a1, b1}; // ERROR - private diff --git a/gcc/testsuite/g++.old-deja/g++.law/arm9.C b/gcc/testsuite/g++.old-deja/g++.law/arm9.C index 528478f9f3f..b3b753c1a91 100644 --- a/gcc/testsuite/g++.old-deja/g++.law/arm9.C +++ b/gcc/testsuite/g++.old-deja/g++.law/arm9.C @@ -1,33 +1 @@ -// Build don't link: -// GROUPS passed ARM-compliance -#include <iostream.h> -enum f1 { - F1 -}; - -enum f2 { - F2 -}; - -class A { -public: - void set (f1 f); -}; -void A::set (f1 f) { cout << "called A f1\n";} - -class B : public A { -public: - void set (f2 f); -}; -void B::set (f2 f) { cout << "called B\n";} // ERROR - candidate - -main() { - B b; - b.set(F1); // ARM page 309: should call A.set(f1) and that what g++ does,// ERROR - .* - // but 13.1 of ARM clearly states that it should call B::set() - // or generate an error because overloading works only for - // functions within the same scope (first page of chapter 13) - // while member of derived and base classes are considered to - // belong to different scopes. Thus B::set() should have - // hidden (completely) the A::set() function. -} +int main() { diff --git a/gcc/testsuite/g++.old-deja/g++.law/array1.C b/gcc/testsuite/g++.old-deja/g++.law/array1.C index fc40bc581e0..29b55ae70ac 100644 --- a/gcc/testsuite/g++.old-deja/g++.law/array1.C +++ b/gcc/testsuite/g++.old-deja/g++.law/array1.C @@ -1,31 +1 @@ -// GROUPS passed arrays -// array file -// Message-Id: <9204120353.AA06266@cs.rice.edu> -// From: dougm@cs.rice.edu (Doug Moore) -// Subject: constructors not called on new'ed array elements -// Date: Sat, 11 Apr 92 22:53:35 CDT - -#include <stdio.h> - -int i = 0; - -class foo -{ -private: - static foo *array; -public: - foo() - { - i++; - } -}; - -foo* foo::array = new foo [5]; - -main() -{ - if (i != 5) - printf ("FAIL\n"); - else - printf ("PASS\n"); -} +int main() diff --git a/gcc/testsuite/g++.old-deja/g++.law/bad-error6.C b/gcc/testsuite/g++.old-deja/g++.law/bad-error6.C index a58a5fad2e4..a1bf1a8b294 100644 --- a/gcc/testsuite/g++.old-deja/g++.law/bad-error6.C +++ b/gcc/testsuite/g++.old-deja/g++.law/bad-error6.C @@ -1,26 +1 @@ -// Build don't link: -// GROUPS passed bad-errors -typedef unsigned long size_t; - -class tt { - public: - tt(int); - - private: - void *operator new(size_t a); // Forbid object creation in heap memory. -}; - -void st(const tt&, int); - -void ff(int i, int j) -{ - if( i > 0 ) { - // This work ok. - tt a_tt(i); - st(a_tt, j); - } - else { - // This triggers an error because of private operator new ????. - st(tt(-i), j); - } -} +typedef __SIZE_TYPE__ size_t; diff --git a/gcc/testsuite/g++.old-deja/g++.law/bad-error7.C b/gcc/testsuite/g++.old-deja/g++.law/bad-error7.C index 479dbf575f1..29b55ae70ac 100644 --- a/gcc/testsuite/g++.old-deja/g++.law/bad-error7.C +++ b/gcc/testsuite/g++.old-deja/g++.law/bad-error7.C @@ -1,24 +1 @@ -// Build don't link: -// GROUPS passed bad-errors -#include <iostream.h> - -class ParX - { - public: - ParX() {} - }; - -class X : public ParX - { - public: - void fn2() { cout << "hi" << endl; } - }; - -main() - { - X x; - ParX* pParX = &x; - void (ParX::*p)() = (void (ParX::*)()) &X::fn2; // line 19 - - (pParX->*p)(); - } +int main() diff --git a/gcc/testsuite/g++.old-deja/g++.law/code-gen1.C b/gcc/testsuite/g++.old-deja/g++.law/code-gen1.C index b122e908988..29b55ae70ac 100644 --- a/gcc/testsuite/g++.old-deja/g++.law/code-gen1.C +++ b/gcc/testsuite/g++.old-deja/g++.law/code-gen1.C @@ -1,20 +1 @@ -// GROUPS passed code-generation -// code-gen file -// From: Jeffrey C. Gealow <jgealow@mtl.mit.edu> -// Date: Sun, 4 Jul 93 18:57:53 -0400 -// Subject: increment bug (0 + 1 + 1 = 3) -// Message-ID: <9307042257.AA23538@mtl.mit.edu> - -#include <stdio.h> - -main() -{ - int i = 0; - (++i)++; - if (i == 2) - printf ("PASS\n"); - else - printf ("FAIL\n"); -} - - +int main() diff --git a/gcc/testsuite/g++.old-deja/g++.law/code-gen3.C b/gcc/testsuite/g++.old-deja/g++.law/code-gen3.C deleted file mode 100644 index a9de4838ca1..00000000000 --- a/gcc/testsuite/g++.old-deja/g++.law/code-gen3.C +++ /dev/null @@ -1,33 +0,0 @@ -// GROUPS passed code-generation -// execution test - XFAIL *-*-* -// code-gen file -// From: mscha@anne.wifo.uni-mannheim.de (Martin Schader) -// Date: Wed, 4 Aug 93 19:14:52 +0200 -// Message-ID: <9308041714.AA00752@anne.wifo.uni-mannheim.de> - -extern "C" int printf (const char *, ...); - -template<class T> struct Y { - Y* next; -}; - -template<class T> struct X { - X() { ptrY = 0; } - void f(); - Y<T>* ptrY; -}; - -template<class T> void X<T>::f() { - ptrY->next = ptrY = new Y<T>; -// -// Use two assignment statements and it works -// ptrY = new Y<T>; -// ptrY->next = ptrY; -} - -int main() { - X<int> x; - x.f(); - printf ("PASS\n"); - exit(0); -} diff --git a/gcc/testsuite/g++.old-deja/g++.law/code-gen4.C b/gcc/testsuite/g++.old-deja/g++.law/code-gen4.C index a9070ed4ea8..29b55ae70ac 100644 --- a/gcc/testsuite/g++.old-deja/g++.law/code-gen4.C +++ b/gcc/testsuite/g++.old-deja/g++.law/code-gen4.C @@ -1,30 +1 @@ -// GROUPS passed code-generation -// code-gen file -// From: david.binderman@pmsr.philips.co.uk -// Date: Tue, 17 Aug 93 10:09:38 BST -// Subject: .* broken in 2.4.5 -// Message-ID: <9308170909.AA05509@pmsr.philips.co.uk> - -class A { -public: - char c; -}; - -typedef char A::*PMA; - -PMA pmA = &A::c; - -A oA; - -extern "C" int printf( const char *, ...); - -main() -{ - oA.c = 'q'; - - if ( (oA .* pmA)) - printf( "PASS\n"); - else - printf(" FAIL\n"); -} - +int main() diff --git a/gcc/testsuite/g++.old-deja/g++.law/code-gen5.C b/gcc/testsuite/g++.old-deja/g++.law/code-gen5.C index fa55dbe8302..29b55ae70ac 100644 --- a/gcc/testsuite/g++.old-deja/g++.law/code-gen5.C +++ b/gcc/testsuite/g++.old-deja/g++.law/code-gen5.C @@ -1,283 +1 @@ -// GROUPS passed code-generation -// code-gen file -// From: "David" <norman@pi14.arc.umn.edu> -// Date: Mon, 15 Nov 1993 20:59:14 -0600 (CST) -// Subject: An error! -// Message-ID: <9311160259.AA03353@pi14.arc.umn.edu> - -#include <stdlib.h> -#include <stdio.h> -#include <assert.h> -#include <fstream.h> -#include <iostream.h> -#include <math.h> - -#define ANSI_C - -typedef double VEC ; - -class Vector; - -class VectorInt -{ - public: - - /* Nothing public!! Only Vector can use this class */ - - private: - - VectorInt( int ); - VectorInt( int, double *, int = 0 ); - VectorInt( const VectorInt & ); - ~VectorInt(); - - VectorInt *refer(); - void unrefer(); - int count; /* Number of Vector's refering to me */ - - VEC *vec; - - friend class Vector; - friend class VecElem; -}; - -class VecElem -{ - public: - - operator double(); - double operator=( double ); - - private: - - VecElem( Vector &, int ); - VecElem( const VecElem & ); - - Vector &v; - int row; /* Row element refers to */ - - friend class Vector; -}; - -class Vector -{ - public: - - Vector(); // Must be assigned to before used - Vector( VectorInt * ); - Vector( int ); - Vector( int, double *, int beg = 0 ); - Vector( const Vector & ); - Vector &operator=( const Vector & ); - ~Vector() { if(r) r->unrefer(); }; - - int row() const { return 19; } - int dim() const { return 10; } - - double operator()( int ) const; - VecElem operator()( int ); - - double assign( int, double ); - - friend ostream& operator<<( ostream&, const Vector& m ); - - private: - - VectorInt *r; /* Reference to real data */ - - friend class VecElem; - friend class LUDecom; - friend class SVD; -}; - - -Vector:: -Vector() - : r(0) -{} - -Vector:: -Vector( VectorInt *vi ) - : r(vi) -{ - r->refer(); -} - -Vector:: -Vector( int row ) -{ - assert( row > 0 ); - - r = new VectorInt( row ); - - r->refer(); -} - -Vector:: -Vector( int row, double *d, int beg ) -{ - assert( row > 0 ); - - r = new VectorInt( row, d, beg ); - - r->refer(); -} - -Vector:: -Vector( const Vector &A ) - : r( A.r->refer() ) -{} - -Vector& Vector:: -operator=( const Vector &A ) -{ - if( r ) - r->unrefer(); - - r = A.r->refer(); - - return *this; -} - -double Vector:: -operator()( int row ) const -{ - assert( r ); - - return *r->vec; -} - -VecElem Vector:: -operator()( int r ) -{ - assert(r); - - return VecElem( *this, r ); -} - - /* assign changes the matrix, it does not create a new one! */ -double Vector:: -assign( int rownum, double d ) -{ - assert(r); - - if( rownum > row() || rownum <= 0 ) { - cerr << "Warning: trying to assign out of bounds" << endl; - cerr << "row " << rownum << endl; - cerr << "Vector size " << row() << endl; - abort(); - } - - if( r->count == 1 ) { - /* Don't need to create a new matrix, since we are the only */ - /* one pointing to ours */ - } - else { - VectorInt *vi = new VectorInt( *r ); - r->unrefer(); - r = vi->refer(); - } - - return d; -} - - -VectorInt:: -VectorInt( int sx ) - : vec( new double[sx] ), count(0) -{ } - -VectorInt:: -VectorInt( int sx, double *, int ) - : vec( new double[sx] ), count(0) -{ -} - -VectorInt:: -VectorInt( const VectorInt & ) - : vec( new double[10] ), count(0) -{ -} - -VectorInt * VectorInt:: -refer() -{ - count ++; - return this; - - // cout << "Refering vec" << endl; -} - -void VectorInt:: -unrefer() -{ - count--; - - if( count == 0 ) { - delete this; - } - - // cout << "Unrefering vec" << endl; -} - -VectorInt:: -~VectorInt() -{ - delete vec; - vec = 0; -} - -VecElem:: -VecElem( Vector &vec, int r ) - : v(vec), row(r) -{ - if( r < 1 || r > vec.row() ) { - cerr << "Trying to access vector element out of bounds" << endl; - abort(); - } -} - -VecElem:: -VecElem( const VecElem &elem ) - : v(elem.v), row(elem.row) -{} - -VecElem:: -operator double() -{ - assert( v.r->vec ); - return *v.r->vec; -}; - -double VecElem:: -operator=( double d ) -{ - return v.assign( row, d ); -} - - - - - -int makeforms( Vector cen, Vector **a, Vector **b ); - -main() -{ - Vector *a[8], *b[8], disp(3); - Vector cen(3), cen2(3); - int i, j; - - if (makeforms (cen,a,b) != 10) - printf ("FAIL\n"); - else - printf ("PASS\n"); - - -} - -int -makeforms( Vector cen, Vector **a, Vector **b) -{ - return 10; -} - +int main() diff --git a/gcc/testsuite/g++.old-deja/g++.law/copy1.C b/gcc/testsuite/g++.old-deja/g++.law/copy1.C index cd237068628..29b55ae70ac 100644 --- a/gcc/testsuite/g++.old-deja/g++.law/copy1.C +++ b/gcc/testsuite/g++.old-deja/g++.law/copy1.C @@ -1,66 +1 @@ -// GROUPS passed copy-ctors -#include <stdio.h> - -int pass = 0; -class name { - int namestuff; -public: - name() { - namestuff = 111; - } - name(const name& subject); - - name & operator = (const name& right) { - this->namestuff = right.namestuff; - return *this; - } - - ~name() { - ; - } -}; - -name::name(const name& subject) { - pass = 1; -} - -class person { - int personstuff; - name personname; -public: - person() { - ; - personstuff = 222; - } - ~person() { - ; - } - void print() { - ; - } - -}; - -void -test(person argp) -{ - person testp; - - ; - argp.print(); - testp = argp; - argp.print(); - testp.print(); - ; -} - -main() -{ - person mainp; - test(mainp); - if (pass) - printf ("PASS\n"); - else - printf ("FAIL\n"); -} - +int main() diff --git a/gcc/testsuite/g++.old-deja/g++.law/ctors11.C b/gcc/testsuite/g++.old-deja/g++.law/ctors11.C index 8472fb89394..29b55ae70ac 100644 --- a/gcc/testsuite/g++.old-deja/g++.law/ctors11.C +++ b/gcc/testsuite/g++.old-deja/g++.law/ctors11.C @@ -1,21 +1 @@ -// Build don't link: -// GROUPS passed constructors -// ctor file -// Message-Id: <9302081631.AA14744@tera.com> -// From: rrh@tera.com (Robert R. Henry) -// Date: Mon, 8 Feb 93 08:31:39 PST -extern "C" void printf(const char *,...); -class A{ -public: - inline A(int x){printf("constructing A with %d\n", x);} -}; - -class B:public A{ -private: -public: -}; // ERROR - non-default constructor - -main() -{ - B(10);// ERROR - B doesn't have a constructor taking int -} +int main() diff --git a/gcc/testsuite/g++.old-deja/g++.law/ctors12.C b/gcc/testsuite/g++.old-deja/g++.law/ctors12.C index 37d45884398..29b55ae70ac 100644 --- a/gcc/testsuite/g++.old-deja/g++.law/ctors12.C +++ b/gcc/testsuite/g++.old-deja/g++.law/ctors12.C @@ -1,33 +1 @@ -// GROUPS passed constructors -#include <stdio.h> -#include <stdlib.h> -#include <iostream.h> - -#define MAGIC 7654 - -class complex { - double re; - double im; - int magic; - static int count; -public: - complex() { re=im=0; magic=MAGIC; } - complex(double d) { re=d; im=0; magic=MAGIC; } - complex(double d, double d2) {re=d; im=d2; magic=MAGIC; } - ~complex() {if(magic!=MAGIC) {printf("FAIL\n");exit(0);}} - friend ostream& operator << (ostream& o, const complex& c) - { return o << "(" << c.re << "," << c.im << ")"; } -}; - -int complex::count=0; - -main() -{ - complex v[6] = {1, complex(1,2), complex(), 2 }; // ARM Sect. 12.6.1 - int i; // page 289 - - for(i=0; i<6; i++) ; - printf ("PASS\n"); - - return 0; -} +int main() diff --git a/gcc/testsuite/g++.old-deja/g++.law/ctors13.C b/gcc/testsuite/g++.old-deja/g++.law/ctors13.C index a0bb6f2008f..c78f8beb520 100644 --- a/gcc/testsuite/g++.old-deja/g++.law/ctors13.C +++ b/gcc/testsuite/g++.old-deja/g++.law/ctors13.C @@ -1,16 +1,2 @@ -// Build don't link: -// GROUPS passed constructors -#include <iostream.h> - -class A { - A() {} // private constructor// ERROR - .* -}; // WARNING - all member functions are private - -main() { - A* a = new A();// ERROR - .* - if (a) { - cout << "a != NULL\n"; - } else { - cout << "a == NULL\n"; - } -} +}; +int main() { diff --git a/gcc/testsuite/g++.old-deja/g++.law/ctors16.C b/gcc/testsuite/g++.old-deja/g++.law/ctors16.C index 4da7f058b5a..b3b753c1a91 100644 --- a/gcc/testsuite/g++.old-deja/g++.law/ctors16.C +++ b/gcc/testsuite/g++.old-deja/g++.law/ctors16.C @@ -1,49 +1 @@ -// GROUPS passed constructors -// ctor file -// Message-Id: <9306021533.AA14347@icepick.jts.com> -// From: roland@jts.com (Roland Knight ) -// Subject: gcc 2.4.1 bug -// Date: Wed, 2 Jun 1993 11:33:34 -0400 - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> - -char stuff[50]; -char *p = stuff; - -class A { -public: - A() { *p++ = 'A';} -}; - -class B { -public: - B() { *p++ = 'B'; } -}; - -class C : public A, public B { -public: - C() : B(), A() { *p++ = 'C'; } -}; - -class D : public A, public B { -public: - D() : B() { *p++ = 'D'; } -}; - -class E : public A, public B { -public: - E() { *p++ = 'E'; } -}; - - -main() { - C c; - D d; - E e; - if (strncmp ("ABCABDABE", stuff, 9)) - printf ("FAIL\n"); - else - printf ("PASS\n"); -} +int main() { diff --git a/gcc/testsuite/g++.old-deja/g++.law/ctors17.C b/gcc/testsuite/g++.old-deja/g++.law/ctors17.C index 41e3217faf9..29b55ae70ac 100644 --- a/gcc/testsuite/g++.old-deja/g++.law/ctors17.C +++ b/gcc/testsuite/g++.old-deja/g++.law/ctors17.C @@ -1,21 +1 @@ -// Build don't link: -// GROUPS passed constructors -// ctor file -// Message-Id: <199306151813.gD28471@mail.Germany.EU.net> -// From: stephan@ifconnection.de (Stephan Muehlstrasser) -// Subject: gcc 2.4.3.1: illegal constructor call not rejected -// Date: Tue, 15 Jun 1993 18:34:14 +0200 (MET DST) - - -#include <fstream.h> - -class X : public ifstream { - public: - X(int a, char *b) {} // ERROR - candidate -}; // ERROR - candidate -main() -{ - X *y = new X(10, "123"); - // the compiler must reject this constructor call: - X *x = new X("abc");// ERROR - .* -} +int main() diff --git a/gcc/testsuite/g++.old-deja/g++.law/ctors2.C b/gcc/testsuite/g++.old-deja/g++.law/ctors2.C index 8ceb5395f69..b3b753c1a91 100644 --- a/gcc/testsuite/g++.old-deja/g++.law/ctors2.C +++ b/gcc/testsuite/g++.old-deja/g++.law/ctors2.C @@ -1,69 +1 @@ -// GROUPS passed constructors -// Message-Id: <m0p8Am6-0002fCC@neal.ctd.comsat.com> -// Date: Fri, 10 Dec 93 11:33 EST -// From: neal@ctd.comsat.com (Neal Becker) -// Subject: serious problems with static constructors - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> - -#define CONST const - -class Sig { - -public: - - enum Type { Byte_t, Word_t, Long_t, Float_t, Double_t, Complex_t, ComplexLong_t, Bad_t }; - -private: - - Type T; - -public: - - static CONST char *ByteMagic, *WordMagic, *LongMagic, - *FloatMagic, *DoubleMagic, *ComplexMagic, *ComplexLongMagic, *BadMagic; - - struct SigTable { - Type T; - CONST char* Magic; - }; - - static CONST SigTable sigTable[]; - -}; - -CONST char -*Sig::ByteMagic = "BYTE", -*Sig::WordMagic = "WORD", -*Sig::LongMagic = "LONG", -*Sig::FloatMagic = "FLOA", -*Sig::DoubleMagic = "DOUB", -*Sig::ComplexMagic = "COMP", -*Sig::ComplexLongMagic = "CMPL", -*Sig::BadMagic = NULL; - - -CONST Sig::SigTable Sig::sigTable[] = { - { Byte_t, ByteMagic }, - { Word_t, WordMagic }, - { Long_t, LongMagic }, - { Float_t, FloatMagic }, - { Double_t, DoubleMagic }, - { Complex_t, ComplexMagic }, - { ComplexLong_t, ComplexLongMagic }, - { Bad_t, BadMagic } -}; - -main() { - if (strcmp (Sig::sigTable[0].Magic, "BYTE") - || strcmp (Sig::sigTable[1].Magic, "WORD") - || strcmp (Sig::sigTable[2].Magic, "LONG") - || strcmp (Sig::sigTable[3].Magic, "FLOA") - || strcmp (Sig::sigTable[4].Magic, "DOUB") - || strcmp (Sig::sigTable[5].Magic, "COMP")) - printf ("FAIL\n"); - else - printf ("PASS\n"); -} +int main() { diff --git a/gcc/testsuite/g++.old-deja/g++.law/ctors8.C b/gcc/testsuite/g++.old-deja/g++.law/ctors8.C index f773d093633..29b55ae70ac 100644 --- a/gcc/testsuite/g++.old-deja/g++.law/ctors8.C +++ b/gcc/testsuite/g++.old-deja/g++.law/ctors8.C @@ -1,24 +1 @@ -// GROUPS passed constructors -// ctor file -// Message-Id: <199212160609.AA18247@phecda.cs.sfu.ca> -// From: Taj Khattra <khattra@cs.sfu.ca> -// Subject: gcc 2.3.1 global ctor bug ? -// Date: Tue, 15 Dec 92 22:09:37 PST - -#include <stdio.h> - -struct foo { - foo() : index(-1) {} - int index; -}; - -foo *arr = new foo[2]; - -main() -{ - if (arr[0].index == -1 - && arr[1].index == -1) - printf ("PASS\n"); - else - printf ("FAIL\n"); -} +int main() diff --git a/gcc/testsuite/g++.old-deja/g++.law/ctors9.C b/gcc/testsuite/g++.old-deja/g++.law/ctors9.C index 280b429c352..29b55ae70ac 100644 --- a/gcc/testsuite/g++.old-deja/g++.law/ctors9.C +++ b/gcc/testsuite/g++.old-deja/g++.law/ctors9.C @@ -1,39 +1 @@ -// Build don't link: -// Special g++ Options: -pedantic-errors -// GROUPS passed constructors -// ctors file -// Message-Id: <9301132030.AA05210@cs.rice.edu> -// From: dougm@cs.rice.edu (Doug Moore) -// Subject: 2.3.3: accepts ctor-less derived class of ctor-ful base class -// Date: Wed, 13 Jan 93 14:30:21 CST -// Note: It gives an error now. But not a very good one. - -struct Foo -{ - Foo(int aa); - int a; - const Foo* operator-> () const {return this;} -}; - -Foo::Foo(int aa) -:a(aa) -{ } - - -struct var_Foo: public Foo -{ - var_Foo* operator-> () {return this;} -};// ERROR - base.*// ERROR - in class.* - -int blort(Foo& f) -{ - return f->a; -}; - -main() -{ - var_Foo b(2);// ERROR - - b->a = 0; - int x = blort(b); - return x; -} +int main() diff --git a/gcc/testsuite/g++.old-deja/g++.law/cvt1.C b/gcc/testsuite/g++.old-deja/g++.law/cvt1.C index 82641242b49..29b55ae70ac 100644 --- a/gcc/testsuite/g++.old-deja/g++.law/cvt1.C +++ b/gcc/testsuite/g++.old-deja/g++.law/cvt1.C @@ -1,12 +1 @@ -// Build don't link: -// GROUPS passed conversions -// cvt file -// From: dak@pool.informatik.rwth-aachen.de -// Date: Sun, 21 Nov 93 17:40:32 +0100 -// Subject: g++ mixes up array dimensions with new -// Message-ID: <9311211640.AA11787@messua> - -main() -{ - int (*a)[5] = new int[6][5]; -} +int main() diff --git a/gcc/testsuite/g++.old-deja/g++.law/cvt10.C b/gcc/testsuite/g++.old-deja/g++.law/cvt10.C index 01f1e807148..29b55ae70ac 100644 --- a/gcc/testsuite/g++.old-deja/g++.law/cvt10.C +++ b/gcc/testsuite/g++.old-deja/g++.law/cvt10.C @@ -1,60 +1 @@ -// Build don't link: -// GROUPS passed conversions -// cvt file -// Message-Id: <CC7oHn.B4F@izf.tno.nl> -// From: tom@izfcs.izf.tno.nl (Tom Vijlbrief) -// Subject: g++ 2.4.5 has problems with NON virtual shared base classes -// Date: Mon, 23 Aug 1993 12:10:34 GMT - - -#include <stdio.h> - -#define FAIL - -class Base { -public: - Base() { printf("Base::Base\n"); } - virtual ~Base() { printf("Base::~Base\n"); } - virtual void v() { printf("Base::v\n"); } -}; - -class Base2 { -public: - Base2() { printf("Base2::Base2\n"); } - virtual ~Base2() { printf("Base2::~Base2\n"); } - virtual void v() { printf("Base2::v\n"); } -}; - -class A: public Base { -public: - A() { printf("A::A\n"); } - ~A() { printf("A::~A\n"); } - virtual void va() { printf("A::va\n"); } -}; - -#ifdef FAIL -class B: public Base { -#else -class B: public Base2 { -#endif -public: - B() { printf("B::B\n"); } - ~B() { printf("B::~B\n"); } - virtual void vb() { printf("B::vb\n"); } -}; - -class C: public A, public B { -public: - C() { printf("C::C\n"); } - ~C() { printf("C::~C\n"); } - void va() { printf("C::va\n"); } -}; - - -main() -{ - C *cp= new C; - cp->va(); - delete cp; -} - +int main() diff --git a/gcc/testsuite/g++.old-deja/g++.law/cvt11.C b/gcc/testsuite/g++.old-deja/g++.law/cvt11.C index 321368caa74..f48a8ee83de 100644 --- a/gcc/testsuite/g++.old-deja/g++.law/cvt11.C +++ b/gcc/testsuite/g++.old-deja/g++.law/cvt11.C @@ -1,30 +1 @@ -// Build don't link: -// GROUPS passed conversions -// cvt file -// Date: Tue, 10 Nov 92 11:08:08 PST -// From: rrh@tera.com (Robert R. Henry) -// Message-Id: <9211101908.AA13557@tera.com> -// Subject: type cast of qualified const member breaks g++2.3.1 - -#include <stdio.h> - -class Thing{ -private: int x; - public: const int N = -1; // ERROR - bad initialization - Thing(int y); -}; - -class Bar{ public: void doit(void); }; - -void Bar::doit(void) -{ - int i, j; - i = Thing::N; - printf("i = %d\n", i); - - j = (int)Thing::N; - printf("i = %d\n", j); -} -Thing::Thing(int y) { x = y; } -main(){ Bar x; x.doit(); } - +int main(){ Bar x; x.doit(); } diff --git a/gcc/testsuite/g++.old-deja/g++.law/cvt12.C b/gcc/testsuite/g++.old-deja/g++.law/cvt12.C index cce2d9bcda0..29b55ae70ac 100644 --- a/gcc/testsuite/g++.old-deja/g++.law/cvt12.C +++ b/gcc/testsuite/g++.old-deja/g++.law/cvt12.C @@ -1,29 +1 @@ -// GROUPS passed conversions -// cvt file -// Message-Id: <9301071708.AA03432@muresh.et.tudelft.nl> -// From: stravers@muresh.et.tudelft.nl (Paul Stravers) -// Subject: conversion method never called -// Date: Thu, 7 Jan 93 18:08:33 +0100 - -#include <stdio.h> - -class test -{ - double d; - int i; -public: - test(double dd,int ii) {d=dd; i=ii;} // constructor - operator int&() {return i;} // define a conversion from test to int& - int& geti() {return i;} // same thing, but different -}; - -main() -{ - test t(3.14, 5); // Create an object t of class "test" - int x = (int&)t; // This should call operator int&() but it does not ... - int y = t.geti(); // x and y should both be 5 ... - if (x == 5 && y == 5) - printf ("PASS\n"); - else - printf ("FAIL\n"); -} +int main() diff --git a/gcc/testsuite/g++.old-deja/g++.law/cvt13.C b/gcc/testsuite/g++.old-deja/g++.law/cvt13.C index d2f04cc9ec6..29b55ae70ac 100644 --- a/gcc/testsuite/g++.old-deja/g++.law/cvt13.C +++ b/gcc/testsuite/g++.old-deja/g++.law/cvt13.C @@ -1,19 +1 @@ -// Build don't link: -// GROUPS passed conversions -// cvt file -// Message-Id: <ISHAI.93Mar26102509@cs73.technion.ac.il> -// From: ishai@cs.technion.ac.il (& Ben-Aroya) -// Subject: Type conversion problem. -// Date: Fri, 26 Mar 1993 08:25:09 GMT - -typedef int array[10]; - -void f(array &arg) -{ -} - -main() -{ - array var; - f(var); -} +int main() diff --git a/gcc/testsuite/g++.old-deja/g++.law/cvt14.C b/gcc/testsuite/g++.old-deja/g++.law/cvt14.C index 2cf02359f4a..29b55ae70ac 100644 --- a/gcc/testsuite/g++.old-deja/g++.law/cvt14.C +++ b/gcc/testsuite/g++.old-deja/g++.law/cvt14.C @@ -1,15 +1 @@ -// Build don't link: -// GROUPS passed conversions -// cvt file -// Message-Id: <9303241504.AA25988@spock.orl.mmc.com> -// Subject: internal compiler error -// Date: Wed, 24 Mar 1993 10:04:06 -0500 -// From: "Malcolm C. Strickland" <chucks@orl.mmc.com> - - - main() - { - double *d; - d = new double(10); - return 1; - } +int main() diff --git a/gcc/testsuite/g++.old-deja/g++.law/cvt17.C b/gcc/testsuite/g++.old-deja/g++.law/cvt17.C index 6ddffe29d28..29b55ae70ac 100644 --- a/gcc/testsuite/g++.old-deja/g++.law/cvt17.C +++ b/gcc/testsuite/g++.old-deja/g++.law/cvt17.C @@ -1,20 +1 @@ -// Build don't link: -// GROUPS passed conversions -// cvt file -// Message-Id: <9305210124.AA02409@kato.cs.brown.edu> -// From: pcm@cs.brown.edu (Peter C. McCluskey) -// Subject: illegal code compiles silently -// Date: Thu, 20 May 93 21:24:22 -0400 - - - -class Point {}; -class Line_Segment{ public: Line_Segment(const Point&){} }; -class Node { public: Point Location(){ Point p; return p; } }; - -main() -{ - Node** node1; - Line_Segment(node1->Location()); // intended (*node1)// ERROR - .* -} - +int main() diff --git a/gcc/testsuite/g++.old-deja/g++.law/cvt19.C b/gcc/testsuite/g++.old-deja/g++.law/cvt19.C index b15bdfd705a..29b55ae70ac 100644 --- a/gcc/testsuite/g++.old-deja/g++.law/cvt19.C +++ b/gcc/testsuite/g++.old-deja/g++.law/cvt19.C @@ -1,27 +1 @@ -// Build don't link: -// GROUPS passed conversions -// cvt file -// Message-Id: <1166.9307131600@ace.eng.cam.ac.uk> -// From: ajp@eng.cam.ac.uk -// Date: Tue, 13 Jul 93 17:00:44 BST - - -class B {}; - -class A { - public: - operator const B*() const { - return b; - } - private: - B* b; -}; - - -main() -{ - A a; - if (a!=0) { - } -} - +int main() diff --git a/gcc/testsuite/g++.old-deja/g++.law/cvt2.C b/gcc/testsuite/g++.old-deja/g++.law/cvt2.C index 3a5a1b94303..29b55ae70ac 100644 --- a/gcc/testsuite/g++.old-deja/g++.law/cvt2.C +++ b/gcc/testsuite/g++.old-deja/g++.law/cvt2.C @@ -1,42 +1 @@ -// GROUPS passed conversions -#include <stdio.h> -#include <stdlib.h> -#include <iostream.h> -#include <fstream.h> - -extern "C" { -int strncmp (const char *, const char *, size_t); -} - -class cvec { -public: - ~cvec(){ delete s; } - cvec(const char*x) { s = new char[strlen(x)+1]; strcpy(s, x); } - cvec(const cvec& c) { s = new char[strlen(c.s)+1]; strcpy(s, c.s); } - operator const char*() { return s; } -private: - char *s; -}; - -cvec -B(const char* a) -{ - return a; -} - -void -A(const char* s) -{ - // s still ok here - ifstream inf(s); - if (strncmp ("aaa", s, 3)) - printf ("FAIL\n"); - else - printf ("PASS\n"); -} - -main() -{ - A(B("aaa")); -} - +int main() diff --git a/gcc/testsuite/g++.old-deja/g++.law/cvt20.C b/gcc/testsuite/g++.old-deja/g++.law/cvt20.C index 72abbb74807..29b55ae70ac 100644 --- a/gcc/testsuite/g++.old-deja/g++.law/cvt20.C +++ b/gcc/testsuite/g++.old-deja/g++.law/cvt20.C @@ -1,20 +1 @@ -// Build don't link: -// GROUPS passed conversions -// cvt file -// Message-Id: <9307152250.AA24812@volterra> -// From: rst@ai.mit.edu (Robert S. Thau) -// Subject: g++ won't convert char[] to char*& -// Date: Thu, 15 Jul 93 18:50:59 EDT - - -// Compiles fine with Sun CC 2.1 - -void f(char *& x) -{// ERROR - location of error - x++; -} - -main() -{ - f ("foo");// ERROR - init of non-const ref from char* -} +int main() diff --git a/gcc/testsuite/g++.old-deja/g++.law/cvt21.C b/gcc/testsuite/g++.old-deja/g++.law/cvt21.C index c4516c85e26..29b55ae70ac 100644 --- a/gcc/testsuite/g++.old-deja/g++.law/cvt21.C +++ b/gcc/testsuite/g++.old-deja/g++.law/cvt21.C @@ -1,36 +1 @@ -// Build don't link: -// GROUPS passed conversions -// cvt file -// Message-Id: <9307200528.AA02094@legolas> -// From: Mark Kuzmycz <kuzmycz@deakin.edu.au> -// Subject: int & conversion operator -// Date: Tue, 20 Jul 93 15:28:47 EST - -class Int -{ - public: - Int(void); - Int(int); - Int(const Int&); - - Int* copy(void) const; - - operator int&(); - - Int& operator ++(void); - Int& operator --(void); - - private: - int value; -}; - -main() -{ - Int data = 2; - Int test; - - test = data * 12; - data += 1; -} - -// UNKNOWN "FAIL" +int main() diff --git a/gcc/testsuite/g++.old-deja/g++.law/cvt22.C b/gcc/testsuite/g++.old-deja/g++.law/cvt22.C index 9d72a6c4219..29b55ae70ac 100644 --- a/gcc/testsuite/g++.old-deja/g++.law/cvt22.C +++ b/gcc/testsuite/g++.old-deja/g++.law/cvt22.C @@ -1,14 +1 @@ -// Build don't link: -// GROUPS passed conversions -// cvt file -// Message-Id: <93Aug2.163542pdt.26892@franklin.parc.xerox.com> -// From: Jesse Hull <jhull@parc.xerox.com> -// Subject: typedef bug -// Date: Mon, 2 Aug 1993 16:35:28 PDT - -typedef int A[10]; - -main() -{ - int* a1 = new A; -}; +int main() diff --git a/gcc/testsuite/g++.old-deja/g++.law/cvt4.C b/gcc/testsuite/g++.old-deja/g++.law/cvt4.C index 6863c8f74ae..29b55ae70ac 100644 --- a/gcc/testsuite/g++.old-deja/g++.law/cvt4.C +++ b/gcc/testsuite/g++.old-deja/g++.law/cvt4.C @@ -1,27 +1 @@ -// GROUPS passed conversions -// cvt file -// Message-Id: <9308091213.AA11572@emmy.Mathematik.Uni-Dortmund.DE> -// From: Michael Strauch <strauch@emmy.mathematik.uni-dortmund.de> -// Subject: Bug in GCC 2.4.5 -// Date: Mon, 9 Aug 93 14:13:50 MESZ - -extern "C" int printf (const char *, ...); - -int destruct = 2; - - class Test{ - protected: - long x; - public: - Test(){;} - Test(long l) {x=l;} - ~Test() {if (--destruct == 0) printf ("PASS\n");} - }; - - main() - { - long i=1; - Test t; - - t=(Test)i; - } +int main() diff --git a/gcc/testsuite/g++.old-deja/g++.law/cvt5.C b/gcc/testsuite/g++.old-deja/g++.law/cvt5.C index d244b4f5225..c0c35bdbfa5 100644 --- a/gcc/testsuite/g++.old-deja/g++.law/cvt5.C +++ b/gcc/testsuite/g++.old-deja/g++.law/cvt5.C @@ -1,28 +1 @@ -// Build don't link: -// GROUPS passed conversions -// cvt file -// Message-Id: <1992Jul31.142856.10082@ericsson.se> -// From: jonas@ericsson.se (Jonas Nygren) -// Subject: g++ bug -// Date: Fri, 31 Jul 1992 14:28:56 GMT - -class A {}; -class B : public A {}; - -B b; - -class R{ -public: - R() {} - operator B&() { return b; } -}; - -void f(A&) {} - -main(){ - R r; - - f(r); // problem to cast to B& and then to A& -} - - +int main(){ diff --git a/gcc/testsuite/g++.old-deja/g++.law/cvt6.C b/gcc/testsuite/g++.old-deja/g++.law/cvt6.C index 85d5af80abd..b3b753c1a91 100644 --- a/gcc/testsuite/g++.old-deja/g++.law/cvt6.C +++ b/gcc/testsuite/g++.old-deja/g++.law/cvt6.C @@ -1,28 +1 @@ -// Build don't link: -// GROUPS passed conversions -// cvt file -// Message-Id: <9208261851.AA16997@josquin.media.mit.edu> -// From: bilmes@media.mit.edu -// Subject: gcc (g++) 2.2.2 constructing nested class from external scope -// Date: Wed, 26 Aug 92 14:51:17 -0400 - - -class foo { - - class bar { - int i; - public: - bar(int j) { i = j; } - }; - - bar b; -public: - foo() : b(3) {} - void test(bar lb) { b = lb; } -}; - - -main() { - foo f; - f.test(34); // line 18 -} +int main() { diff --git a/gcc/testsuite/g++.old-deja/g++.law/cvt7.C b/gcc/testsuite/g++.old-deja/g++.law/cvt7.C index 34cccd848e0..29b55ae70ac 100644 --- a/gcc/testsuite/g++.old-deja/g++.law/cvt7.C +++ b/gcc/testsuite/g++.old-deja/g++.law/cvt7.C @@ -1,74 +1 @@ -// GROUPS passed conversions -// cvt file -// From: krste@icsi.berkeley.edu (Krste Asanovic) -// Date: Mon, 24 Aug 92 19:05:10 PDT -// Message-Id: <9208250205.AA26351@icsib43.ICSI.Berkeley.EDU> -// Subject: implicit int. convs. from member refs. in switch expressions - -#include <stream.h> -#include <stdio.h> - -class A -{ -public: - A(int j) { i = j; } - A(A& a) { i = a.i; } - operator int() { return i; } - - void assign(int v) { i = v; } - int i; -}; - -class B -{ -public: - B(A& inArg) : in(inArg), out(0) {} - - A& in; - A out; - - void run(); -}; - -void -B::run() -{ - // I get a "switch quantity not an integer" error for this statement. - switch (in) - // Replacing above with "switch (int(in))" removes the error. - { - case 0: - out = 1; - break; - default: - out = 0; - break; - } -} - -main() -{ - A a(1); - - A& ar = a; - - A& ar2 = ar; - - // ....but no errors for this switch statement. - switch (ar2) - { - case 1: - printf ("PASS\n"); - break; - default: - printf ("FAIL\n"); - } - - B b(a); - a.assign(3); - b.run(); - a.assign(0); - b.run(); - - return 0; -} +int main() diff --git a/gcc/testsuite/g++.old-deja/g++.law/cvt8.C b/gcc/testsuite/g++.old-deja/g++.law/cvt8.C index 031e76662a4..b3b753c1a91 100644 --- a/gcc/testsuite/g++.old-deja/g++.law/cvt8.C +++ b/gcc/testsuite/g++.old-deja/g++.law/cvt8.C @@ -1,35 +1 @@ -// Build don't link: -// GROUPS passed conversions -// cvt file -// From: solomon@cs.wisc.edu (Marvin Solomon) -// Message-Id: <9209141509.AA23124@gjetost.cs.wisc.edu> -// Subject: g++ 2.2.2 seems to be forgetting a "const" -// Date: Mon, 14 Sep 92 10:09:58 -0500 - -extern "C" void printf(...); - -struct A { - int i; -}; - -struct B { - int i; - operator const A&() const; -}; - -B::operator const A&() const { - static A a; - a.i = i; - printf("convert B to A at %x\n", &a); - return a; -} - -void f(A &a) { // ERROR - in passing argument - printf("A at %x is %d\n", &a, a.i); -} - -main() { - B b; - b.i = 99; - f(b);// ERROR - .* -} +int main() { diff --git a/gcc/testsuite/g++.old-deja/g++.law/dtors2.C b/gcc/testsuite/g++.old-deja/g++.law/dtors2.C index c1f2d423cc4..b3b753c1a91 100644 --- a/gcc/testsuite/g++.old-deja/g++.law/dtors2.C +++ b/gcc/testsuite/g++.old-deja/g++.law/dtors2.C @@ -1,40 +1 @@ -// GROUPS passed destructors -#include <stdio.h> - -int destruct = 0; - -class bla { - -public: - - inline bla(char * jim) { ; }; - - inline ~bla() { destruct++; if (destruct == 2) printf ("PASS\n");}; -}; - -class ulk { - -public: - - inline ulk() {}; - inline ~ulk() {}; - - void funk(const bla & bob) { ;}; - // ^ interestingly, the code compiles right if - // this & is deleted (and therefore the parameter - // passed as value) -}; - -main() { - - ulk dumm; - - dumm.funk(bla("laberababa")); // this compiles correctly - - dumm.funk((bla)"laberababa"); // this produces incorrect code - - // the temporary instance of - // the class "bla" is constructed - // but never destructed... - - -} +int main() { diff --git a/gcc/testsuite/g++.old-deja/g++.law/dtors3.C b/gcc/testsuite/g++.old-deja/g++.law/dtors3.C index ce5aaf335f0..29b55ae70ac 100644 --- a/gcc/testsuite/g++.old-deja/g++.law/dtors3.C +++ b/gcc/testsuite/g++.old-deja/g++.law/dtors3.C @@ -1,37 +1 @@ -// GROUPS passed destructors -// dtor file -// Message-Id: <9301242117.AA04053@cs.rice.edu> -// From: dougm@cs.rice.edu (Doug Moore) -// Subject: 2.3.3: premature dtor of temp? -// Date: Sun, 24 Jan 93 15:17:07 CST - -#include <stdio.h> -#include <stdlib.h> - -int killed = 0; - -class Foo -{ - int a; -public: - Foo() - :a(0) {;} - ~Foo() { killed++;} - Foo& operator << (int b) - { - a += b; - if (killed) - { - printf ("FAIL\n"); - exit (0); - } - return *this; - } -}; - -main() -{ - Foo() << 1 << 3 << 5 << 7; - printf ("PASS\n"); -} - +int main() diff --git a/gcc/testsuite/g++.old-deja/g++.law/dtors4.C b/gcc/testsuite/g++.old-deja/g++.law/dtors4.C index 028839515b5..c0c35bdbfa5 100644 --- a/gcc/testsuite/g++.old-deja/g++.law/dtors4.C +++ b/gcc/testsuite/g++.old-deja/g++.law/dtors4.C @@ -1,22 +1 @@ -// GROUPS passed destructors -#include <stdio.h> - -int destruct = 2; - -class a { - public: - char *p; - a(){ ; } - ~a(){ destruct--; if (! destruct) printf ("PASS\n");} -}; - -a test(){ - return a(); -} - -main(){ - a ai; - - ai = test(); -} - +int main(){ diff --git a/gcc/testsuite/g++.old-deja/g++.law/dtors5.C b/gcc/testsuite/g++.old-deja/g++.law/dtors5.C index 9aa2e6d79ec..b3b753c1a91 100644 --- a/gcc/testsuite/g++.old-deja/g++.law/dtors5.C +++ b/gcc/testsuite/g++.old-deja/g++.law/dtors5.C @@ -1,33 +1 @@ -// GROUPS passed destructors -// dtor file: -// Message-Id: <1992Jun25.181845.18886@leland.Stanford.EDU> -// From: niz@leland.stanford.edu (Jim Nisbet) -// Subject: gcc 2.2.2 -- c++ bug: destructor called twice (example) -// Date: 25 Jun 92 18:18:45 GMT - -#include <stdio.h> - -int things = 0; - -class foo { -public: - foo() { things++; } - foo(const foo&) { things++; } - ~foo() { things--; } - - int i; -}; - -void -sub(foo f) { - ; -}; - - -main() { - sub(foo()); - if (things == 0) - printf ("PASS\n"); - else - printf ("FAIL\n"); -} +int main() { diff --git a/gcc/testsuite/g++.old-deja/g++.law/enum3.C b/gcc/testsuite/g++.old-deja/g++.law/enum3.C index c7db587bd24..29b55ae70ac 100644 --- a/gcc/testsuite/g++.old-deja/g++.law/enum3.C +++ b/gcc/testsuite/g++.old-deja/g++.law/enum3.C @@ -1,21 +1 @@ -// Build don't link: -// GROUPS passed enums -// enum file -// From: frode@auticon.no -// Date: Wed, 13 Jan 93 9:24:50 PST -// Subject: enum trouble -// Message-ID: <"nac.no.001:13.00.93.18.40.52"@nac.no> - -typedef enum{on, off} TOGGLE; - -class field { -private: - TOGGLE toggle; -public: - virtual void on(void) { toggle = 3; };// ERROR - .* - virtual void off(void) { toggle = on; };// ERROR - .* -}; - -main() -{ -} +int main() diff --git a/gcc/testsuite/g++.old-deja/g++.law/except6.C b/gcc/testsuite/g++.old-deja/g++.law/except6.C index da09ae6bc1a..fedb04aa71d 100644 --- a/gcc/testsuite/g++.old-deja/g++.law/except6.C +++ b/gcc/testsuite/g++.old-deja/g++.law/except6.C @@ -1,27 +1 @@ -// Build don't link: -// Special g++ Options: -fexceptions -// GROUPS passed exceptions -// except file -// From: GUSTAVO%DRAGON@orion.cpqd.ansp.br -// Date: 15 Dec 1993 09:33:30 +0000 (C) -// Subject: exception handling problem -// Message-ID: <01H6I5GEAF5UPBJ0UV@VENUS.CPQD.ANSP.BR> - -struct Exception - { - int v; - Exception(int i) { v = i; }; - }; - - inc(int &i) - { - try { - if (i == 0) - throw Exception(i); - else - i++; - } - catch (Exception v) { - i = v.v; - } - } +void inc(int &i) diff --git a/gcc/testsuite/g++.old-deja/g++.law/friend4.C b/gcc/testsuite/g++.old-deja/g++.law/friend4.C index 5502a002dc5..e69de29bb2d 100644 --- a/gcc/testsuite/g++.old-deja/g++.law/friend4.C +++ b/gcc/testsuite/g++.old-deja/g++.law/friend4.C @@ -1,20 +0,0 @@ -// Build don't link: -// GROUPS passed friends -// excess errors test - XFAIL *-*-* -// friends file -// From: osinski@cs.nyu.edu (Ed Osinski) -// Date: Fri, 05 Jun 92 20:47:37 -0400 -// Subject: parameter name forgotten in certain friends -// Message-ID: <9206060047.AA05594@MURRAY.CS.NYU.EDU> - -class T2; - -class T { - friend void f (int&); -}; - -class T2 { - friend void f (int& i) { // BOGUS - - i = 1; - }; -}; diff --git a/gcc/testsuite/g++.old-deja/g++.law/global-init1.C b/gcc/testsuite/g++.old-deja/g++.law/global-init1.C index ce641254e62..fca7aa3a92f 100644 --- a/gcc/testsuite/g++.old-deja/g++.law/global-init1.C +++ b/gcc/testsuite/g++.old-deja/g++.law/global-init1.C @@ -1,20 +1 @@ -// GROUPS passed initialization -// global-init file -// Message-Id: <9212021756.AA12639@grumpy.pocs.com> -// From: wp@pocs.com (Wolfgang Polak) -// Subject: Initializers - gcc 2.2.2 (g++), Sparc, SunOS 4.1.1 -// Date: Wed, 2 Dec 92 09:56:01 PST - -#include <stdio.h> -struct S { int a; int c; }; -int i = 3; -S s = {6, i}; -S * the_s () { return &s; }; -main () -{ - S * cls = the_s (); - if (cls->a != 6) - printf ("FAIL\n"); - else - printf ("PASS\n"); -} +int main () diff --git a/gcc/testsuite/g++.old-deja/g++.law/init11.C b/gcc/testsuite/g++.old-deja/g++.law/init11.C index d5c4e769e4f..29b55ae70ac 100644 --- a/gcc/testsuite/g++.old-deja/g++.law/init11.C +++ b/gcc/testsuite/g++.old-deja/g++.law/init11.C @@ -1,24 +1 @@ -// GROUPS passed initialization -// init file -// From: hansen@srd.ull.rdc.toshiba.co.jp -// Date: Mon, 13 Dec 93 18:27:51 +0900 -// Subject: g++ Bug -// Message-ID: <9312130927.AA08192@VLCS151.noname> - -#include <stdio.h> - -int X = 7; - -struct foo { - int a,b,c; -}; - -struct foo Ack = {5, X, 3}; - -main() -{ - if (Ack.a == 5 && Ack.b == 7 && Ack.c == 3) - printf ("PASS\n"); - else - printf ("FAIL\n"); -} +int main() diff --git a/gcc/testsuite/g++.old-deja/g++.law/init14.C b/gcc/testsuite/g++.old-deja/g++.law/init14.C index a65dc68af59..29b55ae70ac 100644 --- a/gcc/testsuite/g++.old-deja/g++.law/init14.C +++ b/gcc/testsuite/g++.old-deja/g++.law/init14.C @@ -1,26 +1 @@ -// GROUPS passed initialization -// init file -// From: hansen@srd.ull.rdc.toshiba.co.jp -// Message-Id: <9312130927.AA08192@VLCS151.noname> -// Subject: g++ Bug -// Date: Mon, 13 Dec 93 18:27:51 +0900 - -#include <stdio.h> - -int X = 7; - -struct foo { - int a,b,c; -}; - -struct foo Ack = {5, X, 3}; - -main() -{ - if (Ack.a != 5 - || Ack.b != 7 - || Ack.c != 3) - printf ("FAIL\n"); - else - printf ("PASS\n"); -} +int main() diff --git a/gcc/testsuite/g++.old-deja/g++.law/init3.C b/gcc/testsuite/g++.old-deja/g++.law/init3.C index de0473ec5a1..b3b753c1a91 100644 --- a/gcc/testsuite/g++.old-deja/g++.law/init3.C +++ b/gcc/testsuite/g++.old-deja/g++.law/init3.C @@ -1,12 +1 @@ -// Build don't link: -// GROUPS passed initialization -// init file -// From: thayer@moose.cs.columbia.edu (Charles Thayer) -// Date: Wed, 30 Sep 92 02:38:17 EDT -// Subject: small bug -// Message-ID: <9209300638.AA22334@moose.cs.columbia.edu> - -main() { -int offset; -char buf[offset]=""; // ERROR - ansi forbids variable arrays -} +int main() { diff --git a/gcc/testsuite/g++.old-deja/g++.law/init9.C b/gcc/testsuite/g++.old-deja/g++.law/init9.C index baad1396a92..b3b753c1a91 100644 --- a/gcc/testsuite/g++.old-deja/g++.law/init9.C +++ b/gcc/testsuite/g++.old-deja/g++.law/init9.C @@ -1,35 +1 @@ -// GROUPS passed initialization -// init file -// From: Richard Speed <speed@cs.montana.edu> -// Date: Sun, 6 Jun 1993 15:19:41 -0600 (MDT) -// Subject: excess elements in aggr initzer -// Message-ID: <Pine.3.07.9306061541.A10267-b100000@fubar.cs.montana.edu> - -extern "C" void printf (char *, ...); - -class samp { - int a; -public: - samp(int n) { a = n; } - int get_a() { return a; } -}; - -main() { - samp ob[4] [2] = { // Generated Error - 1, 2, - 3, 4, - 5, 6, - 7, 8, - }; - int i; - - if (ob[0][0].get_a() == 1 && ob[0][1].get_a() == 2 - && ob[1][0].get_a() == 3 && ob[1][1].get_a() == 4 - && ob[2][0].get_a() == 5 && ob[2][1].get_a() == 6 - && ob[3][0].get_a() == 7 && ob[3][1].get_a() == 8) - printf ("PASS\n"); - else - printf ("FAIL\n"); - - return 0; -} +int main() { diff --git a/gcc/testsuite/g++.old-deja/g++.law/inline4.C b/gcc/testsuite/g++.old-deja/g++.law/inline4.C index c6a15a9ad8f..29b55ae70ac 100644 --- a/gcc/testsuite/g++.old-deja/g++.law/inline4.C +++ b/gcc/testsuite/g++.old-deja/g++.law/inline4.C @@ -1,20 +1 @@ -// GROUPS passed inlining -// inline file -// Message-Id: <9306020823.AA14027@joker> -// From: stefan@mpi-sb.mpg.de -// Subject: gcc-2.4.2 template function bug (1) -// Date: Wed, 2 Jun 93 10:23:14 +0200 - -extern "C" int printf (const char *, ...); - -template <class T> inline T func(const T& x) { return x; } - -inline int func(const int& x) { return x; } - - -main() -{ int x; - func(x); - printf ("PASS\n"); - } - +int main() diff --git a/gcc/testsuite/g++.old-deja/g++.law/missed-error1.C b/gcc/testsuite/g++.old-deja/g++.law/missed-error1.C index 50accb55440..91d909a57ad 100644 --- a/gcc/testsuite/g++.old-deja/g++.law/missed-error1.C +++ b/gcc/testsuite/g++.old-deja/g++.law/missed-error1.C @@ -1,11 +1,12 @@ -// Build don't link: -// GROUPS passed missed-error -// missed-error file -// From: John Carr <jfc@Athena.MIT.EDU> -// Date: Tue, 02 Feb 1993 07:38:53 EST -// Subject: Re: g++ ignores language context of function pointers -// Message-ID: <9302021238.AA01513@Achates.MIT.EDU> - - typedef void (*pfv2)(double, double); - extern "C" { typedef void (*pfv3)(double, double); }// ERROR - , XFAIL *-*-* +typedef void (*pfv)(); +void f (); +extern "C" +{ + typedef void (*pcfv)(void); + void cf (void); +} +pfv p = f; +pfv p2 = cf; // ERROR - mismatch XFAIL *-*-* +pcfv p3 = f; // ERROR - mismatch XFAIL *-*-* +pcfv p4 = cf; diff --git a/gcc/testsuite/g++.old-deja/g++.law/missed-error2.C b/gcc/testsuite/g++.old-deja/g++.law/missed-error2.C index 4589bb11235..18a026d1502 100644 --- a/gcc/testsuite/g++.old-deja/g++.law/missed-error2.C +++ b/gcc/testsuite/g++.old-deja/g++.law/missed-error2.C @@ -11,7 +11,7 @@ inline int max(int a, int b) {return a > b ? a : b;}; // ERROR - candidate inline double max(double a, double b) {return a > b ? a : b;}; // ERROR - candidate -main() { +int main() { static void foo(int i, int j, double x, double y) ;// ERROR - .* foo(4, -37, 14.39, 14.38); diff --git a/gcc/testsuite/g++.old-deja/g++.law/nest3.C b/gcc/testsuite/g++.old-deja/g++.law/nest3.C index 405a1604250..b3b753c1a91 100644 --- a/gcc/testsuite/g++.old-deja/g++.law/nest3.C +++ b/gcc/testsuite/g++.old-deja/g++.law/nest3.C @@ -1,25 +1 @@ -// Build don't link: -// GROUPS passed nest -#include <iostream.h> - -struct inner { - static void f() { cout << "inner::f()\n";} -}; - -struct outer { - - struct inner { - static void f() { cout << "outer::inner::f()\n";} - }; - - static void f() { - inner::f(); //call of outer::inner::f() - ::inner::f(); //(try to) call inner::f() => parse error - } -}; - -main() { - outer::f(); - cout << endl; - return 0; -} +int main() { diff --git a/gcc/testsuite/g++.old-deja/g++.law/nest4.C b/gcc/testsuite/g++.old-deja/g++.law/nest4.C index 183442d61db..29b55ae70ac 100644 --- a/gcc/testsuite/g++.old-deja/g++.law/nest4.C +++ b/gcc/testsuite/g++.old-deja/g++.law/nest4.C @@ -1,20 +1 @@ -// Build don't link: -// GROUPS passed nest -// nest file -// From: Neal Young <ney@princeton.edu> -// Date: Mon, 11 Oct 93 17:03:59 EDT -// Subject: g++ 2.4.5 bug report: local class decl can't access local static var -// Message-ID: <9310112103.AA06326@cs> - -void f() -{ - static int s; - - struct local { - int j() { return s; } // should be okay, see 1991 ref. man. r.9.8 - }; -} - -main() -{ -} +int main() diff --git a/gcc/testsuite/g++.old-deja/g++.law/operators1.C b/gcc/testsuite/g++.old-deja/g++.law/operators1.C deleted file mode 100644 index fa4c10cf3b9..00000000000 --- a/gcc/testsuite/g++.old-deja/g++.law/operators1.C +++ /dev/null @@ -1,27 +0,0 @@ -// GROUPS passed operators -// opr-conv file -// Message-Id: <199301040217.AA04377@cypress.ucsc.edu> -// From: "Dean R. E. Long" <dlong@cse.ucsc.edu> -// Subject: conversion operator bug? -// Date: Sun, 3 Jan 1993 18:17:20 -0800 - -#include <stdio.h> -class B {}; - -class A { - B *p; -public: - A() { p = 0; } - operator B * () { return p; } - operator B & () { return *p; } -}; - -main() -{ - A a; - B &b = (B &)a; - B *bp = (B *)a; - B &br = a.operator B&(); -// What's the right test? - printf ("FAIL\n"); -} diff --git a/gcc/testsuite/g++.old-deja/g++.law/operators10.C b/gcc/testsuite/g++.old-deja/g++.law/operators10.C index fe4f13d4b99..29b55ae70ac 100644 --- a/gcc/testsuite/g++.old-deja/g++.law/operators10.C +++ b/gcc/testsuite/g++.old-deja/g++.law/operators10.C @@ -1,23 +1 @@ -// Build don't link: -// GROUPS passed operators -// opr-eq file -// Message-Id: <9306040324.AA22954@balder.cs.wisc.edu> -// From: so@cs.wisc.edu (Bryan So) -// Subject: g++ bug -// Date: Thu, 3 Jun 93 22:24:13 -0500 - -template <class T> -struct Test { - int data; - Test& operator=(int i) { data = i; return *this; } -}; - - -main() -{ - Test<int> i, j; - - i = j; - - return 0; -} +int main() diff --git a/gcc/testsuite/g++.old-deja/g++.law/operators13.C b/gcc/testsuite/g++.old-deja/g++.law/operators13.C index 3675d50b7fb..29b55ae70ac 100644 --- a/gcc/testsuite/g++.old-deja/g++.law/operators13.C +++ b/gcc/testsuite/g++.old-deja/g++.law/operators13.C @@ -1,24 +1 @@ -// Build don't link: -// GROUPS passed operators -// opr-eq file -// Message-Id: <1993Nov18.210502.28842@midway.uchicago.edu> -// From: mps@dent.uchicago.edu (Michael Spertus) -// Subject: g++ 2.5.4 bug : operator= -// Date: Thu, 18 Nov 1993 21:05:02 GMT - -class T { -}; - -class EP { -public: - void operator=(T *); -}; - - -void EP::operator=(T *) { } - -main() -{ - EP ep1, ep2; - ep1 = ep2; -} +int main() diff --git a/gcc/testsuite/g++.old-deja/g++.law/operators14.C b/gcc/testsuite/g++.old-deja/g++.law/operators14.C index 191266fe4a2..b3b753c1a91 100644 --- a/gcc/testsuite/g++.old-deja/g++.law/operators14.C +++ b/gcc/testsuite/g++.old-deja/g++.law/operators14.C @@ -1,10 +1 @@ -// Build don't link: -// GROUPS passed operators -void foo (int * a, int * b, int * c) {} - -main() { - int a,b,c; - foo (&a, &b, &c); - (a = b) = c; -} - +int main() { diff --git a/gcc/testsuite/g++.old-deja/g++.law/operators16.C b/gcc/testsuite/g++.old-deja/g++.law/operators16.C index 384c4e9c286..090a634bc24 100644 --- a/gcc/testsuite/g++.old-deja/g++.law/operators16.C +++ b/gcc/testsuite/g++.old-deja/g++.law/operators16.C @@ -1,29 +1 @@ -// GROUPS passed operators -// copy file -// From: gfm@mencon.mencon.oz.au (Graham Menhennitt) -// Date: Thu, 29 Apr 93 20:53:07 EST -// Subject: 4 bugs in g++ 2.3.3 -// Message-ID: <9304291053.AA00090@mencon> - -#include <stdio.h> - -int pass = 0; -struct A { - A(void) {} - A(const A& a) { ; } - A& operator = (const A& a) { pass = 1; } -}; - -struct B { - B(const A& aa) { B::a = aa; } - A a; -}; - -main(void) -{ - B(A()); - if (pass) - printf ("PASS\n"); - else - printf ("FAIL\n"); -} +int main(void) diff --git a/gcc/testsuite/g++.old-deja/g++.law/operators21.C b/gcc/testsuite/g++.old-deja/g++.law/operators21.C index c1f8b8be133..b3b753c1a91 100644 --- a/gcc/testsuite/g++.old-deja/g++.law/operators21.C +++ b/gcc/testsuite/g++.old-deja/g++.law/operators21.C @@ -1,16 +1 @@ -// Build don't link: -// GROUPS passed operators - -struct A { - int x; -}; - -int operator()(A x,float y) {// ERROR - .* - return 1; -} - -main() { - A x; - x(1.0); // ERROR - no match -} - +int main() { diff --git a/gcc/testsuite/g++.old-deja/g++.law/operators28.C b/gcc/testsuite/g++.old-deja/g++.law/operators28.C index c0d1ecdad2d..29b55ae70ac 100644 --- a/gcc/testsuite/g++.old-deja/g++.law/operators28.C +++ b/gcc/testsuite/g++.old-deja/g++.law/operators28.C @@ -1,30 +1 @@ -// Build don't link: -// GROUPS passed operators -#include <sys/types.h> -#include <stdio.h> - -class new_test -{ - int type; -public: - void* operator new(size_t sz, int count, int type); -}; - -void* new_test::operator new(size_t sz, int count, int type) -{ - void *p; - - printf("%d %d %d\n", sz, count, type); - - p = new char[sz * count]; - ((new_test *)p)->type = type; - return p; -}; - -main() -{ - new_test *test; - int count = 13; - - test = new(count, 1) new_test; -}; +int main() diff --git a/gcc/testsuite/g++.old-deja/g++.law/operators30.C b/gcc/testsuite/g++.old-deja/g++.law/operators30.C index 3c23a060a2d..e9b6d280feb 100644 --- a/gcc/testsuite/g++.old-deja/g++.law/operators30.C +++ b/gcc/testsuite/g++.old-deja/g++.law/operators30.C @@ -1,25 +1,3 @@ -// GROUPS passed operators -// opr-mm file -// Date: Thu, 2 Jun 94 10:00:29 +0200 -// From: chatty@cenatls.cena.dgac.fr (Stephane Chatty) -// Message-Id: <9406020800.AA14201@geant.cenatls.cena.dgac.fr> -// Subject: result of operator -- with g++-2.5.8 - -#include <stdio.h> - -nop() -{ -} // ERROR - non-void - -main () -{ - int a = 2; - - if (----a == 0) - nop (); - - if (a == 0) - printf("PASS\n"); - else - printf("FAIL\n"); +void nop() } +int main () diff --git a/gcc/testsuite/g++.old-deja/g++.law/operators32.C b/gcc/testsuite/g++.old-deja/g++.law/operators32.C index bb6f8c902ae..29b55ae70ac 100644 --- a/gcc/testsuite/g++.old-deja/g++.law/operators32.C +++ b/gcc/testsuite/g++.old-deja/g++.law/operators32.C @@ -1,55 +1 @@ -// Build don't link: -// GROUPS passed operators -#include <iostream.h> - -// -// frees space allocated for N-D array -// - -template <class T> -void free(long rows, T** array) -{ -for( long i = 0; i < rows; i++ ) - delete [] array[i]; // delete row -delete [] array; // delete outer array -} - -template <class T> -T* allocate1d(long size, T*& array) -{ -return array = new T[size]; -} - -template <class T> -T** allocate2d(long d1, long d2, T**& array) -{ -if( allocate1d(d1, array) != 0 ) - { - for( long i = 0; i < d1; i++ ) - { - if( allocate1d(d2, array[i]) == 0 ) - { - free(i,array); - return array; - } - } - } -return array; -} - -main() -{ -long d1 = 3, d2 = 4; -class foo -{ -public: -foo() {cout << "foo created" << endl; } - -~foo() {cout << "foo deleted" << endl; } -}; - -foo **f2; -allocate2d(d1, d2, f2);// ERROR - type.*// ERROR - trying to.* -free(d1, f2);// ERROR - type.*// ERROR - trying to.* - -} +int main() diff --git a/gcc/testsuite/g++.old-deja/g++.law/operators4.C b/gcc/testsuite/g++.old-deja/g++.law/operators4.C index e5df81d3a29..044249fa8b7 100644 --- a/gcc/testsuite/g++.old-deja/g++.law/operators4.C +++ b/gcc/testsuite/g++.old-deja/g++.law/operators4.C @@ -22,7 +22,7 @@ void foo(int s) Vector junk(s); } -main() +int main() { Vector* test; for (int i=0;i<40;i++) // was 100000 diff --git a/gcc/testsuite/g++.old-deja/g++.law/operators7.C b/gcc/testsuite/g++.old-deja/g++.law/operators7.C deleted file mode 100644 index 7d00bd7c2ba..00000000000 --- a/gcc/testsuite/g++.old-deja/g++.law/operators7.C +++ /dev/null @@ -1,44 +0,0 @@ -// GROUPS passed operators -// opr-as file -// From: amichail@lambert.waterloo.edu (Amir Michail) -// Date: Mon, 15 Jun 1992 19:41:37 GMT -// Subject: inheretance bug -// Message-ID: <AMICHAIL.92Jun15144137@lambert.waterloo.edu> - -#include <stdio.h> -class window { - public: - int k; - virtual void inc() {} -}; - -class window_border : public virtual window { - public: - void inc () { k++; } -}; - -class container { - public: - window_border c; -#if 0 - container& operator = (const container& o) { - this->c = o.c; - return *this; - } -#endif -}; - -int main() { - container test, *test2; - void *vp; - test2 = new container; - test.c.k = 34; - vp = (window *)&test2->c; - *test2 = test; - test.c.k = 60; - if (test2->c.k == 35 - && test.c.k == 60) - printf ("PASS\n"); - else - printf ("FAIL\n"); -} diff --git a/gcc/testsuite/g++.old-deja/g++.law/operators8.C b/gcc/testsuite/g++.old-deja/g++.law/operators8.C index 0b59d3cd1b5..b3b753c1a91 100644 --- a/gcc/testsuite/g++.old-deja/g++.law/operators8.C +++ b/gcc/testsuite/g++.old-deja/g++.law/operators8.C @@ -1,49 +1 @@ -// GROUPS passed operators -#include <stdio.h> - -class shape { - public: - virtual void vDisplay(void) const = 0; - protected: - int X; - int Y; -}; - -class square :public shape { - public: - square(int x, int y, int width_) { - X = x; - Y = y; - width = width_; - } - void vDisplay(void) const { - printf ("PASS\n"); - } - protected: - int width; -}; - - -class triangle :public shape { - public: - triangle(int x, int y, int width_, int height_) { - X = x; - Y = y; - width = width_; - height = height_; - } - void vDisplay(void) const { - printf ("FAIL\n"); - } - protected: - int width; - int height; -}; - -main() { - shape* s1 = new square(4,4,5); - shape* s2 = new triangle(6,6,2,3); - *s1 = *s2; - s1->vDisplay(); -} - +int main() { diff --git a/gcc/testsuite/g++.old-deja/g++.law/parsing6.C b/gcc/testsuite/g++.old-deja/g++.law/parsing6.C index 7fcc13c5071..b3b753c1a91 100644 --- a/gcc/testsuite/g++.old-deja/g++.law/parsing6.C +++ b/gcc/testsuite/g++.old-deja/g++.law/parsing6.C @@ -1,15 +1 @@ -// Build don't link: -// GROUPS passed parsing -// parsing folder -// From: "James S. Vera" <vera@fanaraaken.stanford.edu> -// Date: Thu, 01 Jul 1993 16:36:32 -0700 -// Subject: Mildly complicated type not understood, 2.4.5 -// Message-ID: <9307012336.AA13841@fanaraaken.Stanford.EDU> - -typedef int (*cow[3])(...); - -main() { - cow fs; - int (*pig[3])(...); // line 5 - -} +int main() { diff --git a/gcc/testsuite/g++.old-deja/g++.law/parsing8.C b/gcc/testsuite/g++.old-deja/g++.law/parsing8.C index 9a714a35493..29b55ae70ac 100644 --- a/gcc/testsuite/g++.old-deja/g++.law/parsing8.C +++ b/gcc/testsuite/g++.old-deja/g++.law/parsing8.C @@ -1,31 +1 @@ -// Build don't link: -// GROUPS passed parsing -// parsing folder -// From: nag@soft.flab.fujitsu.co.jp -// Date: Thu, 08 Jul 1993 10:54:59 +0900 -// Subject: g++ cannot understand `void (**f)()' -// Message-ID: <9307080155.AA00496@kumade.soft.flab.fujitsu.co.jp> - - void - func() { - int ( * * i )[ 2 ]; - } - -// Looks like this is probably the same problem -// parsing folder -// From: nag@soft.flab.fujitsu.co.jp -// Date: Thu, 08 Jul 1993 10:54:59 +0900 -// Subject: g++ cannot understand `void (**f)()' -// Message-ID: <9307080155.AA00496@kumade.soft.flab.fujitsu.co.jp> -main() -{ - void (**f)(); -} - - -// Same as -// From: Chris Dodd <dodd@csl.sri.com> -// Date: Fri, 16 Jul 93 17:05:04 -0700 -// Subject: bug in declaration parsing in g++ 2.4.5 -// Message-ID: <9307170005.AA03857@pekoe.csl.sri.com> - +int main() diff --git a/gcc/testsuite/g++.old-deja/g++.law/parsing9.C b/gcc/testsuite/g++.old-deja/g++.law/parsing9.C index 13138ed9fce..29b55ae70ac 100644 --- a/gcc/testsuite/g++.old-deja/g++.law/parsing9.C +++ b/gcc/testsuite/g++.old-deja/g++.law/parsing9.C @@ -1,32 +1 @@ -// Build don't link: -// GROUPS passed parsing -// From: Jason Merrill <jason@cygnus.com> -// Date: Fri, 13 Aug 93 12:49:11 PDT -// Subject: 2.4.5 won't compile array of pointers to functions returning T -// Message-ID: <9308131949.AA26348@cygnus.com> -// From: "Robert M. Keller" <keller@jarthur.Claremont.EDU> -// Subject: g++ bug -// Date: Fri, 13 Aug 93 10:09:27 PDT - -/* Testing declaration of "array of pointers to functions returning T" */ - -typedef int T; - -T foo() -{ return 10; } - -T bar() -{ return 20; } - -T baz() -{ return 30; } - -main() -{ -T (*apfrt[10])(); - -apfrt[0] = foo; -apfrt[1] = bar; -apfrt[2] = baz; - -} +int main() diff --git a/gcc/testsuite/g++.old-deja/g++.law/patches1.C b/gcc/testsuite/g++.old-deja/g++.law/patches1.C index e151a33fa24..29b55ae70ac 100644 --- a/gcc/testsuite/g++.old-deja/g++.law/patches1.C +++ b/gcc/testsuite/g++.old-deja/g++.law/patches1.C @@ -1,24 +1 @@ -// Build don't link: -// GROUPS passed patches -// patches file -// From: david.binderman@pmsr.philips.co.uk -// Date: Wed, 6 Oct 93 17:05:54 BST -// Subject: Reno 1.2 bug fix -// Message-ID: <9310061605.AA04160@pmsr.philips.co.uk> - -int type(float) { return 1; } -int type(double) { return 2; } -int type(long double) { return 3; } - -extern "C" int printf( const char *, ...); - -main() -{ - int i = 0; - if (type(0.0) != 2) - ++i; - if (i > 0) - printf ("FAIL\n"); - else - printf ("PASS\n"); -} +int main() diff --git a/gcc/testsuite/g++.old-deja/g++.law/refs1.C b/gcc/testsuite/g++.old-deja/g++.law/refs1.C index f0b7f118a0f..b3b753c1a91 100644 --- a/gcc/testsuite/g++.old-deja/g++.law/refs1.C +++ b/gcc/testsuite/g++.old-deja/g++.law/refs1.C @@ -1,42 +1 @@ -// GROUPS passed references -// (Message bugs/refs:1) -// From: tal@vlsi.cs.caltech.edu -// Date: Fri, 25 Feb 94 23:55:50 -0800 -// Subject: g++-2.5.8 produces incorrect code for references -// Message-ID: <9402260755.AA27693@vlsi.cs.caltech.edu> - -#include <stdio.h> - -class C { -private: - char** list; -public: - C(char** ); - void count (int&); -}; - -C::C (char** l) { - list = l; -} - -void C::count (int& total) { - if (*list == NULL) - return; - else { - list++; - count (++total); // THIS IS WHERE THE TROUBLE STARTS - } -} - -char * foo[] = { - "one", "two", "three", NULL}; - -main() { - C c(foo); - int i = 0; - c.count(i); - if (i == 3) - printf ("PASS\n"); - else - printf ("FAIL\n"); -} +int main() { diff --git a/gcc/testsuite/g++.old-deja/g++.law/refs4.C b/gcc/testsuite/g++.old-deja/g++.law/refs4.C index a73c078ce98..29b55ae70ac 100644 --- a/gcc/testsuite/g++.old-deja/g++.law/refs4.C +++ b/gcc/testsuite/g++.old-deja/g++.law/refs4.C @@ -1,21 +1 @@ -// GROUPS passed references -extern "C" void printf (char *, ...); - -const int& min(const int& tX, const int& tY) -{ - return tX < tY ? tX : tY; -} - -void foo(const int m, const int n) -{ - if (m == 1 && n == 100) - printf("PASS\n"); - else - printf("FAIL\n"); -} - -main() -{ - foo(min(2, 1), min(100, 200)); - return 0; -} +int main() diff --git a/gcc/testsuite/g++.old-deja/g++.law/scope2.C b/gcc/testsuite/g++.old-deja/g++.law/scope2.C index f8b90529d73..fca7aa3a92f 100644 --- a/gcc/testsuite/g++.old-deja/g++.law/scope2.C +++ b/gcc/testsuite/g++.old-deja/g++.law/scope2.C @@ -1,44 +1 @@ -// GROUPS passed scoping -// scoping file -// From: svkakkad@cs.utexas.edu (Sheetal V. Kakkad) -// Date: Tue, 5 Oct 93 12:38:49 -0500 -// Subject: G++ 2.4.5 - global delete operator not called when using "::delete" -// Message-ID: <9310051738.AA14586@boogie.cs.utexas.edu> - -#include <stdio.h> -#include <stddef.h> -#include <stdlib.h> - -class foo -{ - public: - foo () { ; } - ~foo () { ; } - void *operator new (size_t); - void operator delete (void *); -}; - -void *foo::operator new (size_t size) -{ - return malloc (size); -} - -int overloaded_delete = 0; - -void foo::operator delete (void *data) -{ - free ((char *) data); - overloaded_delete++; -} - -main () -{ - foo *f = new foo; - foo *ff = ::new foo; - ::delete ff; // should call the default delete operator - delete f; - if (overloaded_delete == 1) - printf ("PASS\n"); - else - printf ("FAIL\n"); -} +int main () diff --git a/gcc/testsuite/g++.old-deja/g++.law/scope5.C b/gcc/testsuite/g++.old-deja/g++.law/scope5.C index 2aea15bd94c..29b55ae70ac 100644 --- a/gcc/testsuite/g++.old-deja/g++.law/scope5.C +++ b/gcc/testsuite/g++.old-deja/g++.law/scope5.C @@ -1,25 +1 @@ -// Build don't link: -// GROUPS passed scoping -// local-class file -// From: schlaege@methusalix.ert.rwth-aachen.de (Chris Schlaeger H Zivojnovic) -// Date: Tue, 10 Aug 93 16:50:33 +0200 -// Subject: Bug report -// Message-ID: <9308101450.AA28016@methusalix.ert.rwth-aachen.de> - -main() -{ - class foo - { - int i; - } ; - class bar - { - public: - bar() { y = 0; } - void f() { foo x; } - private: - int y; - } ; - - bar c; -} +int main() diff --git a/gcc/testsuite/g++.old-deja/g++.law/static-mem4.C b/gcc/testsuite/g++.old-deja/g++.law/static-mem4.C index 4e026478e55..29b55ae70ac 100644 --- a/gcc/testsuite/g++.old-deja/g++.law/static-mem4.C +++ b/gcc/testsuite/g++.old-deja/g++.law/static-mem4.C @@ -1,13 +1 @@ -// Build don't link: -// GROUPS passed static-mem -struct test { - void test_member() { - static test& ds = *this; // FIX: static test* ds = this; - } -}; - - -main() -{ - test t; -} +int main() diff --git a/gcc/testsuite/g++.old-deja/g++.law/template1.C b/gcc/testsuite/g++.old-deja/g++.law/template1.C index 809e5090c88..b3b753c1a91 100644 --- a/gcc/testsuite/g++.old-deja/g++.law/template1.C +++ b/gcc/testsuite/g++.old-deja/g++.law/template1.C @@ -1,30 +1 @@ -// Build don't link: -// GROUPS passed templates - -class String { - char s[100]; -}; - -template <class Element> -class Art { -public: - Element *data; - Art() { data=new Element[100]; } -}; - -template <class Key,class Value> -class Assoc { -public: - struct KeyValue { - Key key; - Value value; - int filled; - }; - - Art<KeyValue> data; - int fill; -}; - -main() { - Assoc<String,String> table; -} +int main() { diff --git a/gcc/testsuite/g++.old-deja/g++.law/temps2.C b/gcc/testsuite/g++.old-deja/g++.law/temps2.C index d9684814368..29b55ae70ac 100644 --- a/gcc/testsuite/g++.old-deja/g++.law/temps2.C +++ b/gcc/testsuite/g++.old-deja/g++.law/temps2.C @@ -1,54 +1 @@ -// GROUPS passed temps -// temps file -// Message-Id: <9212181914.AA05066@sparc1.cnm.us.es> -// From: juando@cnm.us.es (Juan Domingo Martin Gomez) -// Subject: Temporaries destroyed too soon -// Date: Fri, 18 Dec 92 20:14:45 +0100 - -#include <stdio.h> - -int status = 0; -int fail = 0; - -class Foo -{ -public: - Foo(); - ~Foo(); - - Foo &method(); -}; - -Foo f1() -{ - return Foo(); -} - -Foo::Foo() -{ -} - -Foo::~Foo() -{ - if (status == 2) - fail = 0; - else - fail = 1; -} - -Foo &Foo::method() -{ - status++; - return *this; -} - -main() -{ - // f1() returns a temporary object. The member function - // method() returns a reference to the same object. - f1().method().method(); - if (fail) - printf ("FAIL\n"); - else - printf ("PASS\n"); -} +int main() diff --git a/gcc/testsuite/g++.old-deja/g++.law/temps3.C b/gcc/testsuite/g++.old-deja/g++.law/temps3.C index 7b092844c5c..fca7aa3a92f 100644 --- a/gcc/testsuite/g++.old-deja/g++.law/temps3.C +++ b/gcc/testsuite/g++.old-deja/g++.law/temps3.C @@ -1,28 +1 @@ -// GROUPS passed temps -// temps file -// Message-Id: <9308231535.AA19432@geant.cenatls.cena.dgac.fr> -// From: chatty@geant.cenatls.cena.dgac.fr (Stephane CHATTY) -// Subject: g++ 2.4.5 does not destroy temporaries -// Date: Mon, 23 Aug 93 17:35:34 +0200 - -#include <stdio.h> - -class A { -public: - int a; - A (int i) : a (i) { ;} - A (const A& aa) : a (aa.a) { ;} - ~A () { printf ("PASS\n");; } -}; - -A -foo () -{ - return A (10); -} - -main () -{ - int x = foo ().a; -} - +int main () diff --git a/gcc/testsuite/g++.old-deja/g++.law/temps6.C b/gcc/testsuite/g++.old-deja/g++.law/temps6.C index e228ce8ea75..29b55ae70ac 100644 --- a/gcc/testsuite/g++.old-deja/g++.law/temps6.C +++ b/gcc/testsuite/g++.old-deja/g++.law/temps6.C @@ -1,24 +1 @@ -// GROUPS passed temps -// Date: Tue, 22 Mar 94 12:46:28 +0100 -// From: dak@pool.informatik.rwth-aachen.de -// Message-Id: <9403221146.AA07815@messua> -// Subject: Bad code for pointer to member use as reference in g++ 2.5.8 - -#include <stdio.h> -struct str { - int i; -} xxx = {0}; - -int& test(str *arg1, int str::*arg2) -{ - return (arg1->*arg2); -} - -main() -{ - test(&xxx, &str::i) = 5; - if (xxx.i == 0) - printf ("FAIL\n"); - else - printf ("PASS\n"); -} +int main() diff --git a/gcc/testsuite/g++.old-deja/g++.law/typeck1.C b/gcc/testsuite/g++.old-deja/g++.law/typeck1.C index 2fabfe9db83..3c117d16672 100644 --- a/gcc/testsuite/g++.old-deja/g++.law/typeck1.C +++ b/gcc/testsuite/g++.old-deja/g++.law/typeck1.C @@ -1,18 +1 @@ -// Build don't link: -// GROUPS passed typeck -// typeck file -// From: vern@daffy.ee.lbl.gov (Vern Paxson) -// Date: 24 Sep 1992 23:11:22 GMT -// Subject: 2.2.2 type-checking error (?) when comparing pointers -// Message-ID: <26475@dog.ee.lbl.gov> - - - class a { }; - class foo : a { }; - class bar : a { }; - - test( const foo* f, const bar* b ) - { - return f == b;// ERROR - - } - + int test( const foo* f, const bar* b ) diff --git a/gcc/testsuite/g++.old-deja/g++.law/typeck2.C b/gcc/testsuite/g++.old-deja/g++.law/typeck2.C index 485a9291866..29b55ae70ac 100644 --- a/gcc/testsuite/g++.old-deja/g++.law/typeck2.C +++ b/gcc/testsuite/g++.old-deja/g++.law/typeck2.C @@ -1,16 +1 @@ -// Build don't link: -// GROUPS passed typeck -// typeck file -// From: Jutta Degener <jutta@cs.tu-berlin.de> -// Date: Wed, 9 Jun 1993 17:58:35 +0200 (MET DST) -// Subject: 2.4.3: Type of new <typedef'ed array> -// Message-ID: <199306091558.AA19075@mail.cs.tu-berlin.de> - - typedef int arr[10]; - main() - { - int * p = new int[10]; - int * q = new arr; /* g++ complains, but shouldn't */ - int (* r)[10] = new arr; /* g++ doesn't complain, but should */// ERROR - - } - +int main() diff --git a/gcc/testsuite/g++.old-deja/g++.law/union1.C b/gcc/testsuite/g++.old-deja/g++.law/union1.C index 5ab9c905583..b3b753c1a91 100644 --- a/gcc/testsuite/g++.old-deja/g++.law/union1.C +++ b/gcc/testsuite/g++.old-deja/g++.law/union1.C @@ -1,30 +1 @@ -// Build don't link: -// GROUPS passed unions -// excess errors test - XFAIL *-*-* -// anon-union file -// From: "Terry R. Coley" <terry@wag.caltech.edu> -// Date: Tue, 25 Aug 1992 17:33:29 -0700 -// Subject: possible bug in gcc/g++ -// Message-ID: <199208260033.AA19417@brahms.wag.caltech.edu> - -typedef enum { BADBINOP = 0, PLUS, MINUS, MULT, DIV, POWR } binoptype; -typedef enum { BADUNOP = 0, NEG = POWR+1, SIN, COS, TAN } unoptype; - -typedef struct { - char *s; - union { - binoptype bop; - unoptype uop; - }; -} -op_to_charp; - -op_to_charp BINOPS[] = { {"+", PLUS}, - {"-", MINUS}, - {"*", MULT}, - {"/", DIV}, - {"^", POWR} }; - -main() { - int dummy; -} +int main() { diff --git a/gcc/testsuite/g++.old-deja/g++.law/union2.C b/gcc/testsuite/g++.old-deja/g++.law/union2.C index 9f812d762e8..32b5a651ca8 100644 --- a/gcc/testsuite/g++.old-deja/g++.law/union2.C +++ b/gcc/testsuite/g++.old-deja/g++.law/union2.C @@ -1,25 +1,2 @@ -// Build don't link: -// GROUPS passed unions -// anon-union file -// From: gerlek@dat.cse.ogi.edu (Michael Gerlek) -// Date: Tue, 8 Dec 92 12:56 PST -// Subject: private anonymous unions have public members? (gcc-2.3.1) -// Message-ID: <m0mzByL-0000hoC@dat.cse.ogi.edu> - -class A { -public: - int x; -private: - int y; - union { - int z; - }; -}; - -void f() { - A a; - - a.x = 0; - a.y = 1;// ERROR - .* - a.z = 2;// ERROR - -} + int y; // ERROR - private + int z; // ERROR - private diff --git a/gcc/testsuite/g++.old-deja/g++.law/unsorted2.C b/gcc/testsuite/g++.old-deja/g++.law/unsorted2.C index 3b81431233d..29b55ae70ac 100644 --- a/gcc/testsuite/g++.old-deja/g++.law/unsorted2.C +++ b/gcc/testsuite/g++.old-deja/g++.law/unsorted2.C @@ -1,26 +1 @@ -// Build don't link: -// GROUPS passed unsorted -// code-gen file -// From: klaus@steinitz.mathematik.uni-dortmund.de -// Date: Mon, 15 Nov 1993 16:51:11 +0100 -// Message-ID: <9311151551.AA17761@steinitz.mathematik.uni-dortmund.de> - -template <int A,int B> -class X -{ -}; - -template <int A,int B,int C> -X<A,C> f(X<A,B>,X<B,C>) -{ - X<A,C> result; - return result; -} - -main() -{ - X<1,3> x; - X<1,2> y; - X<2,3> z; - x=f(y,z); -} +int main() diff --git a/gcc/testsuite/g++.old-deja/g++.law/vbase1.C b/gcc/testsuite/g++.old-deja/g++.law/vbase1.C index a68c3b143b5..b3b753c1a91 100644 --- a/gcc/testsuite/g++.old-deja/g++.law/vbase1.C +++ b/gcc/testsuite/g++.old-deja/g++.law/vbase1.C @@ -1,28 +1 @@ -// Build don't link: -// GROUPS passed vbase -// vbase file -// From: pino@hubble.eecs.berkeley.edu (Jose Luis Pino) -// Date: 28 Jul 1994 05:17:39 GMT -// Subject: g++ 2.6 bug: virtual base class & protected methods -// Message-ID: <317f1j$o9c@agate.berkeley.edu> - - -#include <iostream.h> - -class a { -protected: - virtual void foo() { cout << "Class A\n";} -}; - -class b : public virtual a {}; - -class c : public b { -public: - void bar() { b::foo();} -}; - -main() { - c test; - test.bar(); -} - +int main() { diff --git a/gcc/testsuite/g++.old-deja/g++.law/virtual3.C b/gcc/testsuite/g++.old-deja/g++.law/virtual3.C index d141f87ecb1..b3b753c1a91 100644 --- a/gcc/testsuite/g++.old-deja/g++.law/virtual3.C +++ b/gcc/testsuite/g++.old-deja/g++.law/virtual3.C @@ -1,47 +1 @@ -// GROUPS passed virtual-functions -// virtual file -// From: allan@ramjet.multinet.DE (Allan Brighton) -// Subject: pos. bug in gcc-2.5.2 on hp -// Date: 4 Nov 1993 22:57:36 -0500 -// Message-ID: <9311041820.AA05942@ramjet.multinet.DE> - -#include <iostream.h> -#include <strstream.h> - - -class BugStream : public ostrstream { -public: - BugStream() {} - BugStream& eval(); -}; - - -static struct Eval_ { } eval; -BugStream& operator<<(ostream& os, Eval_); - -BugStream& BugStream::eval() -{ - // make sure str is null terminated - *this << ends; - - // eval the command and set the status - char* s = str(); - cerr << s << endl; - - // reset the stream for the next command - clear(0); - rdbuf()->freeze(0); - seekp(0); - - return *this; -} - -BugStream& operator<<(ostream& os, Eval_) -{ - return ((BugStream&)os).eval(); -} - -main() { - BugStream bs; - bs << "PASS" << eval; -} +int main() { diff --git a/gcc/testsuite/g++.old-deja/g++.law/virtual4.C b/gcc/testsuite/g++.old-deja/g++.law/virtual4.C index f6310d35fa1..29b55ae70ac 100644 --- a/gcc/testsuite/g++.old-deja/g++.law/virtual4.C +++ b/gcc/testsuite/g++.old-deja/g++.law/virtual4.C @@ -1,31 +1 @@ -// GROUPS passed virtual-functions -#include <stdio.h> -#include <stdlib.h> - -int aset = 0; -class A -{ - public: - void Set() { SetProp(); } - virtual void SetProp() { aset++;} -}; - -class B:public A -{ - public: - void SetProp() { if (!aset) { printf ("FAIL\n"); exit (0);} aset--;} -}; - -main() -{ - A a; - B b; - A *c=new A; - A *d=new B; - - a.Set(); - b.Set(); - c->Set(); - d->Set(); - printf ("PASS\n"); -} +int main() diff --git a/gcc/testsuite/g++.old-deja/g++.law/visibility1.C b/gcc/testsuite/g++.old-deja/g++.law/visibility1.C index 0314c0741c2..67f4bcd9919 100644 --- a/gcc/testsuite/g++.old-deja/g++.law/visibility1.C +++ b/gcc/testsuite/g++.old-deja/g++.law/visibility1.C @@ -51,7 +51,7 @@ derived_friend() -main(int argc, char *argv[]) +int main(int argc, char *argv[]) //========================== { base b; diff --git a/gcc/testsuite/g++.old-deja/g++.law/visibility11.C b/gcc/testsuite/g++.old-deja/g++.law/visibility11.C index 9fa31dc3163..e10148ac124 100644 --- a/gcc/testsuite/g++.old-deja/g++.law/visibility11.C +++ b/gcc/testsuite/g++.old-deja/g++.law/visibility11.C @@ -1,48 +1,5 @@ -// Build don't link: -// Special g++ Options: -w -// GROUPS passed visibility -// visibility file -// From: Alan Shepherd <a.shepherd@nexor.co.uk> -// Date: Tue, 22 Jun 1993 14:53:23 +0100 -// Subject: bug with MI in gcc-2.4.5 -// Message-ID: <9659.740757203@nexor.co.uk> - -class A -{ - int a; - -protected: - - virtual void State(int b) { a = b; } - -}; - -class B : public A -{ - char* foo; - public: + D(); - B(const char*); -}; - -class C : public A -{ - char* foo2; - -public: - - C(const char*); -}; - -class D : public B, public C -{ -protected: - virtual void State(int a) - { - B::State(a); - C::State(a); - } -}; diff --git a/gcc/testsuite/g++.old-deja/g++.law/visibility12.C b/gcc/testsuite/g++.old-deja/g++.law/visibility12.C index c3a9963f994..212614ac243 100644 --- a/gcc/testsuite/g++.old-deja/g++.law/visibility12.C +++ b/gcc/testsuite/g++.old-deja/g++.law/visibility12.C @@ -1,18 +1 @@ -// Build don't link: -// GROUPS passed visibility -// visibility file -// From: Mark Rawling <Mark.Rawling@mel.dit.csiro.au> -// Date: Wed, 30 Jun 93 15:28:34 +1000 -// Subject: member access rule bug -// Message-ID: <9306300528.AA17185@coda.mel.dit.CSIRO.AU> -struct a { - int aa; - }; - -class b : private a { - }; - -class c : public b { - int xx(void) { return (aa); } // aa should be invisible// ERROR - .* - }; - + int aa; // ERROR - private diff --git a/gcc/testsuite/g++.old-deja/g++.law/visibility13.C b/gcc/testsuite/g++.old-deja/g++.law/visibility13.C index 8bd6a851b71..7f634e20cd8 100644 --- a/gcc/testsuite/g++.old-deja/g++.law/visibility13.C +++ b/gcc/testsuite/g++.old-deja/g++.law/visibility13.C @@ -23,8 +23,8 @@ public: virtual Type& operator[](int ix) { return ia[ix]; } private: void init(const Type*, int); - int size; - int *ia; + int size; // ERROR - private + int *ia; // ERROR - private }; template <class Type> @@ -94,7 +94,7 @@ try_array( Array_RC<Type> &rc ) try_array( ((Array<Type>&)rc) ); } -main() +int main() { static int ia[10] = { 12, 7, 14, 9, 128, 17, 6, 3, 27, 5 }; Array_RC<int> iA(ia, 10);// ERROR - instantiated from here diff --git a/gcc/testsuite/g++.old-deja/g++.law/visibility16.C b/gcc/testsuite/g++.old-deja/g++.law/visibility16.C index b5d87ef363d..27c1b484b3d 100644 --- a/gcc/testsuite/g++.old-deja/g++.law/visibility16.C +++ b/gcc/testsuite/g++.old-deja/g++.law/visibility16.C @@ -1,35 +1,3 @@ -// Build don't link: -// GROUPS passed visibility -// visibility file -// From: Marie Trapp <Marie.Trapp@analog.com> -// Date: Thu, 5 Aug 93 11:55:15 EDT -// Subject: access of protected members -// Message-ID: <9308051553.AA07639@nwd2sun1.analog.com> -class A { - protected: - int astuff; - A() { - astuff = 3; - } -}; - -class B : public A { - int bstuff; - public: - B( A *p) { - bstuff = p->astuff;// ERROR - .* - } -}; - -class C : public A { - int cstuff; - public: - C() { - cstuff = 5; - } -}; - -main() { - C cvar; - B bvar(&cvar); -} + int astuff; // ERROR - protected + astuff = 3; +int main() { diff --git a/gcc/testsuite/g++.old-deja/g++.law/visibility17.C b/gcc/testsuite/g++.old-deja/g++.law/visibility17.C index ae198b0bc83..210ffd1442e 100644 --- a/gcc/testsuite/g++.old-deja/g++.law/visibility17.C +++ b/gcc/testsuite/g++.old-deja/g++.law/visibility17.C @@ -1,63 +1 @@ -// Build don't link: -// GROUPS passed visibility -// visibility file -// From: Sandeep Shroff <ss@caere.com> -// Date: Thu, 05 Aug 1993 17:23:20 -0700 -// Subject: Access to private constructor. -// Message-ID: <9308060023.AA10283@neptune.caere.com> -#include <iostream.h> - -class Base -{ -public: - char* getName() {return name_;} - -private: - Base(); - Base(char* str); - - char* name_; -}; - -class Derived : public Base -{ -public: - Derived(int n, char* str); - Derived(int n); - - getNum() {return num_;} -private: - int num_; -}; - -Base::Base() -{ // ERROR - private - name_ = strcpy(new char[strlen(" ") + 1], " "); -} - -Base::Base(char* str) -{ // ERROR - private - if(str != NULL) - name_ = strcpy(new char[strlen(str) + 1], str); -} - -Derived::Derived(int n, char* str) : Base(str) -{// ERROR - .* - num_ = n; -} - -Derived::Derived(int n) : Base() -{// ERROR - .* - num_ = n; -} - - - -int main() -{ - // Derived* d = new Derived(10, "test"); - Derived* d = new Derived(10); - - cerr << d->getNum() << "\t" << d->getName() << endl; -} - + int getNum() {return num_;} diff --git a/gcc/testsuite/g++.old-deja/g++.law/visibility18.C b/gcc/testsuite/g++.old-deja/g++.law/visibility18.C index a294f13edf9..213404624ce 100644 --- a/gcc/testsuite/g++.old-deja/g++.law/visibility18.C +++ b/gcc/testsuite/g++.old-deja/g++.law/visibility18.C @@ -1,20 +1 @@ -// Build don't link: -// GROUPS passed visibility -// visibility file -// From: cmwang@iis.sinica.edu.tw (Chien-Min Wang) -// Date: Fri, 6 Aug 93 19:42:31 CST -// Subject: A bug in g++ 2.4.5 -// Message-ID: <9308061142.AA08533@iiserv> -struct T1 { int i; }; - -struct T2 { int j; }; - -struct T3 : public T1, private T2 { -} x; - -int main () -{ - x.i = 1; - x.j = 2; // error: x.j is private// ERROR - .* - return 0; -} +struct T2 { int j; }; // ERROR - private diff --git a/gcc/testsuite/g++.old-deja/g++.law/visibility19.C b/gcc/testsuite/g++.old-deja/g++.law/visibility19.C index 0f22d6568b7..ba212f3629e 100644 --- a/gcc/testsuite/g++.old-deja/g++.law/visibility19.C +++ b/gcc/testsuite/g++.old-deja/g++.law/visibility19.C @@ -1,40 +1 @@ -// Build don't link: -// GROUPS passed visibility -// visibility file -// From: mclaugh@tnt.acsys.com (Mark A. McLaughlin) -// Date: Wed, 25 Aug 93 14:30:47 MDT -// Subject: g++ bug -// Message-ID: <9308252030.AA02352@tnt.acsys.com> -class B { -protected: - int i; -}; - -class D1 : public B { -}; - -class D2 : public B { - friend void fr(B*,D1*,D2*); - void mem(B*,D1*); -}; - -void fr(B* pb, D1* p1, D2* p2) -{ - pb->i = 1; // illegal// ERROR - .* - p1->i = 2; // illegal// ERROR - .* - p2->i = 3; // ok (access through D2) -} - -void D2::mem(B* pb, D1* p1) -{ - pb->i = 1; // illegal// ERROR - .* - p1->i = 2; // illegal// ERROR - .* - i = 3; // ok (access through `this') -} - -void g(B* pb, D1* p1, D2* p2) -{ - pb->i = 1; // illegal// ERROR - .* - p1->i = 2; // illegal// ERROR - .* - p2->i = 3; // illegal// ERROR - .* -} + int i; // ERROR - protected diff --git a/gcc/testsuite/g++.old-deja/g++.law/visibility2.C b/gcc/testsuite/g++.old-deja/g++.law/visibility2.C index 8ac5cb9e71c..5806fc564b7 100644 --- a/gcc/testsuite/g++.old-deja/g++.law/visibility2.C +++ b/gcc/testsuite/g++.old-deja/g++.law/visibility2.C @@ -51,7 +51,7 @@ derived_friend() -main(int argc, char *argv[]) +int main(int argc, char *argv[]) //========================== { base b; diff --git a/gcc/testsuite/g++.old-deja/g++.law/visibility20.C b/gcc/testsuite/g++.old-deja/g++.law/visibility20.C index 011abef44c9..b3b753c1a91 100644 --- a/gcc/testsuite/g++.old-deja/g++.law/visibility20.C +++ b/gcc/testsuite/g++.old-deja/g++.law/visibility20.C @@ -1,36 +1 @@ -// Build don't link: -// GROUPS passed visibility -// visibility file -// From: doug@foxtrot.ccmrc.ucsb.edu (Douglas Scott) -// Date: Tue, 10 Aug 93 10:06:33 PDT -// Subject: G++ 2.4.5 allows access to protected base members -// Message-ID: <9308101706.AA04485@foxtrot.ccmrc.ucsb.edu> - -class Base { -protected: - void protectedBaseFunction() {} // ERROR - protected -public: - Base() {} -}; - - -class Derived : public Base { -public: - Derived() {} - void noticeThisFunction(Base *); -}; - - -void -Derived::noticeThisFunction(Base *b) { - b->protectedBaseFunction(); // ARM says this is not allowed// ERROR - .* - // since it is not called on 'this' -} - -main() { - Base b; - Derived d; - d.noticeThisFunction(&b); - printf("gpptest run\n");// ERROR - .* -} - +int main() { diff --git a/gcc/testsuite/g++.old-deja/g++.law/visibility23.C b/gcc/testsuite/g++.old-deja/g++.law/visibility23.C deleted file mode 100644 index 3299add8c2b..00000000000 --- a/gcc/testsuite/g++.old-deja/g++.law/visibility23.C +++ /dev/null @@ -1,26 +0,0 @@ -// Build don't link: -// GROUPS passed visibility -// visibility file -// From: Robert Carden <carden@thoth.ics.uci.edu> -// Date: Thu, 12 Aug 1993 13:47:11 -0700 -// Subject: bug 8/12/93 -- #4 -// Message-ID: <9308121347.aa26185@Paris.ics.uci.edu> -// -// 4.cc -// -#include <stream.h> - -class A { - int x; -public: - void f(int); - void f(float); - void g(void *); -}; - - -class B : public A { -private: - A::f; - A::g;// ERROR - .* , XFAIL *-*-* -}; diff --git a/gcc/testsuite/g++.old-deja/g++.law/visibility24.C b/gcc/testsuite/g++.old-deja/g++.law/visibility24.C index b40075fdbe1..29b55ae70ac 100644 --- a/gcc/testsuite/g++.old-deja/g++.law/visibility24.C +++ b/gcc/testsuite/g++.old-deja/g++.law/visibility24.C @@ -1,40 +1 @@ -// Build don't link: -// GROUPS passed visibility -// visibility file -// From: joe@consolve.com (Joe Shapiro) -// Date: Fri, 20 Aug 93 17:18:18 EDT -// Subject: Template classes seem to allow users to get at private members -// Message-ID: <9308202118.AA25599@ghana.consolve> -/* - * private.cc - */ -extern "C" void printf(...); - -template <class T> -class A -{ -public: - void Fun() { printf( "Fun fun fun!\n" ); } // ERROR - private -}; - - -template <class T> -class B: private A<T> -{ -}; - - -class C -{ -public: - C() { _b.Fun(); }// ERROR - .* - -private: - B<int> _b; -}; - - -main() -{ - C c; -} +int main() diff --git a/gcc/testsuite/g++.old-deja/g++.law/visibility4.C b/gcc/testsuite/g++.old-deja/g++.law/visibility4.C index 5a92c6c0794..b2d344d47d2 100644 --- a/gcc/testsuite/g++.old-deja/g++.law/visibility4.C +++ b/gcc/testsuite/g++.old-deja/g++.law/visibility4.C @@ -1,25 +1 @@ -// Build don't link: -// GROUPS passed visibility -// visibility file -// From: dcb@us-es.sel.de (David Binderman 3841) -// Date: Tue, 30 Mar 93 15:48:47 +0200 -// Subject: page 242 of the ARM -// Message-ID: <9303301348.AA20751@slsvitt> - -class A { -public: - int b; -}; - -class C : private A { // NOTE WELL. private, not public -public: - int d; -}; - -extern "C" int printf( const char *, ...); - -class E : public C { - void f() { - printf( "%d\n", b);// ERROR - .* - }; -}; + int b; // ERROR - private diff --git a/gcc/testsuite/g++.old-deja/g++.law/visibility7.C b/gcc/testsuite/g++.old-deja/g++.law/visibility7.C index 26d172bcf81..29b55ae70ac 100644 --- a/gcc/testsuite/g++.old-deja/g++.law/visibility7.C +++ b/gcc/testsuite/g++.old-deja/g++.law/visibility7.C @@ -1,71 +1 @@ -// Build don't link: -// GROUPS passed visibility -// visibility file -// From: Gordon Joly <G.Joly@cs.ucl.ac.uk> -// Date: Wed, 21 Apr 93 09:42:07 +0100 -// Subject: /*** BUG REPORT : THE MYTH OF PRIVATE INHERITANCE ***/ -// Message-ID: <9304210842.AA01815@life.ai.mit.edu> -#include <iostream.h> - -class A { - private: - int number; - public: - A(int i) : number(i) - {} - virtual ~A() - {} - virtual void Number(int c) - { number = c; } // ERROR - private - virtual int Number() - { return number; } // ERROR - private -}; - -class B : private A { - private: - int second_number; - public: - B(int c, int i) : second_number(c), A(i) - {} - virtual ~B() - {} - - virtual void firstNumber(int b) // renames member function Number(int) of class A - { A::Number(b); } - virtual int firstNumber() // renames member function Number() of class A - { return A::Number(); } -}; - - - - -class C { - private: - B* bobject; - public: - C(B* bp) : bobject(bp) - {} - virtual ~C() - {} - // - // the following two functions access - // private member functions of class B - // and they should not be able to do so - // - virtual void setBValue(int i) - { if (bobject) bobject->Number(i); }// ERROR - .* - virtual int getBValue() - { if (bobject) { return bobject->Number(); } return 0; }// ERROR - .* -}; - - -main() -{ - B* bobject = new B(2, 1); - C* cobject = new C(bobject); - cobject->setBValue(8); - cout << cobject->getBValue() << endl; - delete bobject; - delete cobject; -} - +int main() diff --git a/gcc/testsuite/g++.old-deja/g++.law/visibility8.C b/gcc/testsuite/g++.old-deja/g++.law/visibility8.C index 3e5178c6c01..3e2fa4447d0 100644 --- a/gcc/testsuite/g++.old-deja/g++.law/visibility8.C +++ b/gcc/testsuite/g++.old-deja/g++.law/visibility8.C @@ -1,26 +1 @@ -// Build don't link: -// GROUPS passed visibility -// visibility file -// From: roland@jts.com (Roland Knight ) -// Date: Thu, 29 Apr 1993 16:17:00 -0400 -// Subject: gcc 2.3.3 bug -// Message-ID: <m0nof3E-0021ifC@jts.com -class t1 { -protected: - int a; -}; - - -class t2 : private t1 { -public: - int b; -}; - - -class t3 : public t2 { -public: - int ttt(); -}; - - -int t3::ttt() { return a; }// ERROR - .* + int a; // ERROR - protected diff --git a/gcc/testsuite/g++.old-deja/g++.law/visibility9.C b/gcc/testsuite/g++.old-deja/g++.law/visibility9.C index df98640c90d..3e2fa4447d0 100644 --- a/gcc/testsuite/g++.old-deja/g++.law/visibility9.C +++ b/gcc/testsuite/g++.old-deja/g++.law/visibility9.C @@ -1,22 +1 @@ -// Build don't link: -// GROUPS passed visibility -// visibility file -// rom: roland@jts.com (Roland Knight ) -// Date: Sat, 8 May 1993 17:27:35 -0400 -// Subject: gcc 2.3.3 protected member access bug -// Message-ID: <9305082127.AA19577@icepick.jts.com> - -class A { -protected: - int a; -}; - -class B : public A { -public: - void f1(A* pa); -}; - - -void B::f1(A* pa) { - pa->a = 1; // illegal but allowed by gcc// ERROR - .* -} + int a; // ERROR - protected diff --git a/gcc/testsuite/g++.old-deja/g++.law/vtable1.C b/gcc/testsuite/g++.old-deja/g++.law/vtable1.C index c788c179054..dd57290826b 100644 --- a/gcc/testsuite/g++.old-deja/g++.law/vtable1.C +++ b/gcc/testsuite/g++.old-deja/g++.law/vtable1.C @@ -1,27 +1,2 @@ -// Build don't link: -// GROUPS passed vtable -// excess errors test - XFAIL *-*-* -// vtable file -// From: mrs@cygnus.com (Mike Stump) -// Date: Wed, 20 Apr 1994 17:46:11 -0700 -// Subject: vtable name generation is wrong -// Message-ID: <199404210046.RAA25652@rtl.cygnus.com> - -// prepare_fresh_vtable doesn't build the names of -// vtables very well. - -struct B { - virtual void vf() { } -}; - -struct Main { - virtual void vf() { } -}; - -struct Other : public Main, public B { - virtual void vf() { } -}; - -struct D : public Main, public B, public Other { - virtual void vf() { } -} a; +// Build don't link: +// Special g++ Options: -w diff --git a/gcc/testsuite/g++.old-deja/g++.law/vtable3.C b/gcc/testsuite/g++.old-deja/g++.law/vtable3.C index 5759026331d..29b55ae70ac 100644 --- a/gcc/testsuite/g++.old-deja/g++.law/vtable3.C +++ b/gcc/testsuite/g++.old-deja/g++.law/vtable3.C @@ -1,24 +1 @@ -// GROUPS passed vtable -// vtable file -// From: Pete Bevin <pete@deng.icl.co.uk> -// Date: Mon, 28 Nov 1994 19:57:53 +0000 (GMT) -// Subject: g++-2.6.2: Virtual inheritance causes incorrect padding -// Message-ID: <Pine.SOL.3.91.941128194453.7510A-100000@gabriel> - -extern "C" void printf (char *, ...); - -struct A { -}; - - -struct B : virtual A { - public: - int b; -}; - - -main() -{ - B blist[10]; - printf ("PASS\n"); -} +int main() diff --git a/gcc/testsuite/g++.old-deja/g++.martin/ambig1.C b/gcc/testsuite/g++.old-deja/g++.martin/ambig1.C index 3ee730ddc26..9886991e29b 100644 --- a/gcc/testsuite/g++.old-deja/g++.martin/ambig1.C +++ b/gcc/testsuite/g++.old-deja/g++.martin/ambig1.C @@ -2,12 +2,12 @@ //Based on a report by Bill Currie <bcurrie@tssc.co.nz> struct foo { protected: - int x; + int x; // ERROR - candidate }; struct bar { public: - int x(); + int x(); // ERROR - candidate }; struct foobar: public foo, public bar { diff --git a/gcc/testsuite/g++.old-deja/g++.mike/align1.C b/gcc/testsuite/g++.old-deja/g++.mike/align1.C index e26d398e0a9..765014bc66d 100644 --- a/gcc/testsuite/g++.old-deja/g++.mike/align1.C +++ b/gcc/testsuite/g++.old-deja/g++.mike/align1.C @@ -1,56 +1 @@ -// Check to make sure we align virtual base classes properly - -class eel_base { -public: -}; - -class markable_eel_base : public eel_base { -private: - int mark; -}; - -class eel_edge : public markable_eel_base { -public: -private: - int foo; -}; - -class edge : public virtual eel_edge { -public: - edge() { - _weight = 0.0; - } -private: - double _weight; -}; -class eel_branch_edge : public virtual edge { -}; -class branch_edge : public eel_branch_edge { -}; - -class eel_interproc_branch_edge : public branch_edge { -}; - -class interproc_edge : public virtual edge { -}; - -class eel_jump_edge : public virtual edge { -protected: -}; - -class jump_edge : public eel_jump_edge { -public: -}; - -class eel_interproc_jump_edge : public jump_edge { -protected: -}; - -class interproc_jump_edge : public eel_interproc_jump_edge, - public interproc_edge { -public: -}; - -main () { - void *vp = new interproc_jump_edge(); -} +int main () { diff --git a/gcc/testsuite/g++.old-deja/g++.mike/align2.C b/gcc/testsuite/g++.old-deja/g++.mike/align2.C index 36791fed803..29b55ae70ac 100644 --- a/gcc/testsuite/g++.old-deja/g++.mike/align2.C +++ b/gcc/testsuite/g++.old-deja/g++.mike/align2.C @@ -1,16 +1 @@ -class Foo { -}; - -class Bar : virtual Foo { -public: - int b; -} x; - -main() -{ - // printf("Foo offset %d\n", (int)(Foo*)&x - (int)&x); - // printf("b offset %d\n", (int)&x.b - (int)&x); - // printf("sizeof is %d\n", sizeof(Bar)); - // This core dumps on a SPARC is alignment is wrong. - Bar blist[10]; -} +int main() diff --git a/gcc/testsuite/g++.old-deja/g++.mike/ambig1.C b/gcc/testsuite/g++.old-deja/g++.mike/ambig1.C index 5f67b743109..b3b753c1a91 100644 --- a/gcc/testsuite/g++.old-deja/g++.mike/ambig1.C +++ b/gcc/testsuite/g++.old-deja/g++.mike/ambig1.C @@ -1,32 +1 @@ -extern "C" int printf(const char *, ...); - -struct VB { - virtual void f() { - printf("VB\n"); - } -}; - -class M : public virtual VB { -public: - int i; - void f() { - printf("M(%d)\n", i); - } -}; - -class lM : public M { -}; - -class rM : public M { -}; - -class D : public lM, rM { -} d; // ERROR - ambiguous function - -main() { - ((lM*)&d)->i = 1; - ((rM*)&d)->i = 2; - ((rM*)&d)->f(); - ((lM*)&d)->f(); - ((VB*)&d)->f(); -} +int main() { diff --git a/gcc/testsuite/g++.old-deja/g++.mike/conv1.C b/gcc/testsuite/g++.old-deja/g++.mike/conv1.C index b67ecbb0e6f..b3b753c1a91 100644 --- a/gcc/testsuite/g++.old-deja/g++.mike/conv1.C +++ b/gcc/testsuite/g++.old-deja/g++.mike/conv1.C @@ -1,10 +1 @@ -enum E { C }; - -E foo() { - return C; -} - -main() { - if (foo() != C) - return 1; -} +int main() { diff --git a/gcc/testsuite/g++.old-deja/g++.mike/dyncast1.C b/gcc/testsuite/g++.old-deja/g++.mike/dyncast1.C index fbcc489eaaf..3bddb3ce1e4 100644 --- a/gcc/testsuite/g++.old-deja/g++.mike/dyncast1.C +++ b/gcc/testsuite/g++.old-deja/g++.mike/dyncast1.C @@ -4,11 +4,11 @@ #include <typeinfo> struct B { - virtual f() { } + virtual int f() { } }; struct D { - virtual f() { } + virtual int f() { } }; main() { diff --git a/gcc/testsuite/g++.old-deja/g++.mike/dyncast2.C b/gcc/testsuite/g++.old-deja/g++.mike/dyncast2.C index ba7a39edbaa..fcf625e8c69 100644 --- a/gcc/testsuite/g++.old-deja/g++.mike/dyncast2.C +++ b/gcc/testsuite/g++.old-deja/g++.mike/dyncast2.C @@ -6,11 +6,11 @@ #include <typeinfo> struct B { - virtual f() { } + virtual int f() { } } ob; struct D : public B { - virtual f() { } + virtual int f() { } } od; main() { diff --git a/gcc/testsuite/g++.old-deja/g++.mike/dyncast3.C b/gcc/testsuite/g++.old-deja/g++.mike/dyncast3.C index ee775d043f1..72f73f04424 100644 --- a/gcc/testsuite/g++.old-deja/g++.mike/dyncast3.C +++ b/gcc/testsuite/g++.old-deja/g++.mike/dyncast3.C @@ -1,19 +1,2 @@ -// Special g++ Options: -fexceptions -w -// excess errors test - XFAIL a29k-*-* sparc64-*-elf sh-*-* arm-*-pe**-* -// Ensure that the return type of dynamic_cast is the real type. - -struct B { - virtual f() { } -}; - -struct D : public B { - virtual f() { } - int i; -} od; - -main() { - B *b=&od; - if (dynamic_cast<D*>(b)->i) - return 1; - return 0; -} + virtual int f() { } + virtual int f() { } diff --git a/gcc/testsuite/g++.old-deja/g++.mike/eh19.C b/gcc/testsuite/g++.old-deja/g++.mike/eh19.C index 38b4bf16d8b..54f870e7c06 100644 --- a/gcc/testsuite/g++.old-deja/g++.mike/eh19.C +++ b/gcc/testsuite/g++.old-deja/g++.mike/eh19.C @@ -1 +1,3 @@ } catch(test1::fehler()) // function type promoted to pointer + void func(int a) { +int main() { diff --git a/gcc/testsuite/g++.old-deja/g++.mike/eh20.C b/gcc/testsuite/g++.old-deja/g++.mike/eh20.C index 31f3c6f928a..b5287f33795 100644 --- a/gcc/testsuite/g++.old-deja/g++.mike/eh20.C +++ b/gcc/testsuite/g++.old-deja/g++.mike/eh20.C @@ -1,6 +1 @@ -// Build don't link: -// Special g++ Options: -fexceptions -Wall - -main() { - throw 1; -} +int diff --git a/gcc/testsuite/g++.old-deja/g++.mike/eh33.C b/gcc/testsuite/g++.old-deja/g++.mike/eh33.C index 49214f12c88..234b745f3a3 100644 --- a/gcc/testsuite/g++.old-deja/g++.mike/eh33.C +++ b/gcc/testsuite/g++.old-deja/g++.mike/eh33.C @@ -7,9 +7,9 @@ void my_unexpected() { throw 42; } -foo() throw (int) { throw "Hi"; } +void foo() throw (int) { throw "Hi"; } -main() { +int main() { std::set_unexpected (my_unexpected); try { foo(); diff --git a/gcc/testsuite/g++.old-deja/g++.mike/eh34.C b/gcc/testsuite/g++.old-deja/g++.mike/eh34.C index 0f278010023..9c7e985bbea 100644 --- a/gcc/testsuite/g++.old-deja/g++.mike/eh34.C +++ b/gcc/testsuite/g++.old-deja/g++.mike/eh34.C @@ -7,9 +7,9 @@ void my_unexpected() { exit (0); } -foo() throw () { throw "Hi"; } +void foo() throw () { throw "Hi"; } -main() { +int main() { std::set_unexpected (my_unexpected); foo(); return 1; diff --git a/gcc/testsuite/g++.old-deja/g++.mike/eh4.C b/gcc/testsuite/g++.old-deja/g++.mike/eh4.C index 5de9b03ffe6..79c37a0804b 100644 --- a/gcc/testsuite/g++.old-deja/g++.mike/eh4.C +++ b/gcc/testsuite/g++.old-deja/g++.mike/eh4.C @@ -1,6 +1 @@ -// Build don't link: -// Special g++ Options: -fexceptions - -foo() { - throw 1; -} +void foo() { diff --git a/gcc/testsuite/g++.old-deja/g++.mike/eh49.C b/gcc/testsuite/g++.old-deja/g++.mike/eh49.C index 3a301cc54ee..278f434dbab 100644 --- a/gcc/testsuite/g++.old-deja/g++.mike/eh49.C +++ b/gcc/testsuite/g++.old-deja/g++.mike/eh49.C @@ -1,15 +1,2 @@ -// Special g++ Options: -fexceptions -O9 -// excess errors test - XFAIL a29k-*-* sparc64-*-elf sh-*-* arm-*-pe**-* - -main1() { - throw 1; -} - -main() { - try { - main1(); - } catch (...) { - return 0; - } - return 1; -} +void main1() { +int main() { diff --git a/gcc/testsuite/g++.old-deja/g++.mike/eh6.C b/gcc/testsuite/g++.old-deja/g++.mike/eh6.C index f5409867a23..278f434dbab 100644 --- a/gcc/testsuite/g++.old-deja/g++.mike/eh6.C +++ b/gcc/testsuite/g++.old-deja/g++.mike/eh6.C @@ -1,19 +1,2 @@ -// Special g++ Options: -fexceptions -// excess errors test - XFAIL a29k-*-* sparc64-*-elf sh-*-* arm-*-pe**-* - -extern "C" int printf(const char *, ...); - -main1() { - throw 1; -} - - -main() { - try { - main1(); - } catch (...) { - printf("Unwind works!\n"); - return 0; - } - return 1; -} +void main1() { +int main() { diff --git a/gcc/testsuite/g++.old-deja/g++.mike/err2.C b/gcc/testsuite/g++.old-deja/g++.mike/err2.C index e7f0be2a987..35e3bc68521 100644 --- a/gcc/testsuite/g++.old-deja/g++.mike/err2.C +++ b/gcc/testsuite/g++.old-deja/g++.mike/err2.C @@ -1,6 +1 @@ -class foo { -public: - apply(foo *(foo::*memptr)()) { - this->*memptr(); // ERROR - wrong - } -}; + void apply(foo *(foo::*memptr)()) { diff --git a/gcc/testsuite/g++.old-deja/g++.mike/leak1.C b/gcc/testsuite/g++.old-deja/g++.mike/leak1.C index 849322f128c..b3b753c1a91 100644 --- a/gcc/testsuite/g++.old-deja/g++.mike/leak1.C +++ b/gcc/testsuite/g++.old-deja/g++.mike/leak1.C @@ -1,38 +1 @@ -int count = 0; - -class T { - int i; -public: - T() { - i = 1; - ++count; - } - T(const T& o) { - i = o.i; - ++count; - } - T operator +(const T& o) { - T r; - r.i = this->i + o.i; - return r; - } - operator int () { - return i; - } - ~T() { - --count; - } -} s, b; - -void bar() { - static int j = int(s+b); - int i = int(s+b); -} - -int i = int(s+b); - -main() { - bar(); - bar(); - return count != 2; -} +int main() { diff --git a/gcc/testsuite/g++.old-deja/g++.mike/misc1.C b/gcc/testsuite/g++.old-deja/g++.mike/misc1.C index 1703b546318..1ee5e393520 100644 --- a/gcc/testsuite/g++.old-deja/g++.mike/misc1.C +++ b/gcc/testsuite/g++.old-deja/g++.mike/misc1.C @@ -1,53 +1,2 @@ -// GROUPS passed construct-destruct -/* g++ constructs j 13 times, and destructs it once. */ - -extern "C" { - int printf(...); - void exit(int); -} - -void foo() { -} - -class C { - int val; - public: - static int count; - C(int ii) { - val = ii; - ++count; - printf("up\n"); - } - ~C() { - --count; - printf("down\n"); - } - operator ++() { - return ++val; - } - operator int() { - return val; - } -}; - -int C::count = 0; - -void bar() { - for (int ii=0; ii<13; ++ii) - for (C j=1; j<9; ++j) - foo(); -} - -main() { - bar(); - if (C::count) - { - printf("FAIL\n"); - exit(1); - } - else - { - printf("PASS\n"); - } - return 0; -} + int operator ++() { +int main() { diff --git a/gcc/testsuite/g++.old-deja/g++.mike/misc13.C b/gcc/testsuite/g++.old-deja/g++.mike/misc13.C index 80874b15e03..166e33dce6a 100644 --- a/gcc/testsuite/g++.old-deja/g++.mike/misc13.C +++ b/gcc/testsuite/g++.old-deja/g++.mike/misc13.C @@ -39,7 +39,7 @@ ivHandler *bar2() { return &a; } -main() { +int main() { want=vf_request; bar()->request(); want=vf_event; diff --git a/gcc/testsuite/g++.old-deja/g++.mike/misc14.C b/gcc/testsuite/g++.old-deja/g++.mike/misc14.C index 75827cb8c46..4886dcc9274 100644 --- a/gcc/testsuite/g++.old-deja/g++.mike/misc14.C +++ b/gcc/testsuite/g++.old-deja/g++.mike/misc14.C @@ -18,7 +18,7 @@ public: } }; -main() { +int main() { B b; A *ap = &b; ap->~A(); // This should call the destructor virtually. diff --git a/gcc/testsuite/g++.old-deja/g++.mike/misc5.C b/gcc/testsuite/g++.old-deja/g++.mike/misc5.C index bd3e85cee48..9e53eb4eacc 100644 --- a/gcc/testsuite/g++.old-deja/g++.mike/misc5.C +++ b/gcc/testsuite/g++.old-deja/g++.mike/misc5.C @@ -1,11 +1 @@ -// Build don't link: -// GROUPS uncaught -// Cfront bug A.3 (See Language System Release Notes for the -// SPARCompiler C++ version 3.0) - -struct S1 { - static int S1; // ERROR - uses same name 9.3 -}; -struct S2 { - union { int ii; float S2; }; // ERROR - uses same name 9.3 , XFAIL *-*-* -}; + union { int ii; float S2; }; // ERROR - uses same name 9.3 diff --git a/gcc/testsuite/g++.old-deja/g++.mike/misc8.C b/gcc/testsuite/g++.old-deja/g++.mike/misc8.C index 4cea2133422..3e0eff5c112 100644 --- a/gcc/testsuite/g++.old-deja/g++.mike/misc8.C +++ b/gcc/testsuite/g++.old-deja/g++.mike/misc8.C @@ -1,5 +1 @@ -// Build don't link: -// GROUPS passed vtable -class T { public: virtual ~T() {} }; -template<class P> class X : public virtual T {}; -main() { X<int> x; } +int main() { X<int> x; } diff --git a/gcc/testsuite/g++.old-deja/g++.mike/net10.C b/gcc/testsuite/g++.old-deja/g++.mike/net10.C index a290b46e25a..4546bf1bd0b 100644 --- a/gcc/testsuite/g++.old-deja/g++.mike/net10.C +++ b/gcc/testsuite/g++.old-deja/g++.mike/net10.C @@ -4,7 +4,7 @@ const int ci=10, *pc = &ci, *const cpc = pc, **ppc; int i, *p, *const cp = &i; -main() +int main() { i = ci; *cp = ci; diff --git a/gcc/testsuite/g++.old-deja/g++.mike/net17.C b/gcc/testsuite/g++.old-deja/g++.mike/net17.C index f80eeb39613..b3b753c1a91 100644 --- a/gcc/testsuite/g++.old-deja/g++.mike/net17.C +++ b/gcc/testsuite/g++.old-deja/g++.mike/net17.C @@ -1,58 +1 @@ -// example from the ARM page 292 and 293 - -extern "C" int printf(const char *, ...); -extern "C" void exit(int); - -int i = 0; - -class A { -public: - A() { - printf("Doing A\n"); - if (++i != 1) - exit(1); - } -}; - -class B { -public: - B() { - printf("Doing B\n"); - if (++i != 2) - exit(1); - } -}; - -class C : public virtual A, public virtual B { -public: - C() { - printf("Doing C\n"); - if (++i != 3) - exit(1); - } -}; - -class D : public virtual B, public virtual A { -public: - D() { - printf("Doing D\n"); - if (++i != 4) - exit(1); - } -}; - -class E : public C, public D { -public: - E() { - printf("Doing E\n"); - if (++i != 5) - exit(1); - } -} e; - - -main() { - if (++i != 6) - exit(1); - return 0; -} +int main() { diff --git a/gcc/testsuite/g++.old-deja/g++.mike/net22.C b/gcc/testsuite/g++.old-deja/g++.mike/net22.C index 088a0fea4d8..b3b753c1a91 100644 --- a/gcc/testsuite/g++.old-deja/g++.mike/net22.C +++ b/gcc/testsuite/g++.old-deja/g++.mike/net22.C @@ -1,13 +1 @@ -class Parent { -public: - Parent() {} - Parent( char *s ) {} -}; - -class Child : public Parent { -}; // ERROR - called - -main() { - Child c( "String initializer" ); // ERROR - bad - return 0; -} +int main() { diff --git a/gcc/testsuite/g++.old-deja/g++.mike/net26.C b/gcc/testsuite/g++.old-deja/g++.mike/net26.C index 5a00c8e0450..b3b753c1a91 100644 --- a/gcc/testsuite/g++.old-deja/g++.mike/net26.C +++ b/gcc/testsuite/g++.old-deja/g++.mike/net26.C @@ -1,27 +1 @@ -// A test case found by InterViews testing... - -extern "C" int printf(const char *, ...); - -class A { -public: - int foo() { printf("ok nv\n"); } - virtual int vfoo() { printf("ok v\n"); } -}; - -struct S { - int (A::*pfn1)(); - int (A::*pfn2)(); - int (A::*pfn3)(); -}; - -// This failed before. -S s = { &A::foo, &A::vfoo, &A::foo }; - -A a; - -main() { - (a.*s.pfn1)(); - (a.*s.pfn2)(); - printf("PASS\n"); - return 0; -} +int main() { diff --git a/gcc/testsuite/g++.old-deja/g++.mike/net34.C b/gcc/testsuite/g++.old-deja/g++.mike/net34.C index 06d196c890a..b3b753c1a91 100644 --- a/gcc/testsuite/g++.old-deja/g++.mike/net34.C +++ b/gcc/testsuite/g++.old-deja/g++.mike/net34.C @@ -1,36 +1 @@ -#include <iostream.h> - -class foo { -public: - foo(int i) {k = i;} -protected: - int k; -}; - -class bar_1 : public foo { -public: - bar_1(int i) : foo(i) {} - int get_k() {return k;} -}; - -class bar_2 : public foo { -public: - bar_2(int i) : foo(i) {}; - int get_k() {return k;} -}; - -class multiple : public bar_1, public bar_2 { -public: - multiple(int i1, int i2) : bar_1(i1), bar_2(i2) {} - void print() { - cout << "bar_1::k -> " << bar_1::k << "\n"; - cout << "bar_2::k -> " << bar_2::k << "\n"; - cout << "bar_1::get_k() -> " << bar_1::get_k() << "\n"; - cout << "bar_2::get_k() -> " << bar_2::get_k() << "\n"; - } -}; - -main() { - multiple m(1,2); - m.print(); -} +int main() { diff --git a/gcc/testsuite/g++.old-deja/g++.mike/net38.C b/gcc/testsuite/g++.old-deja/g++.mike/net38.C index 5732d594f71..765014bc66d 100644 --- a/gcc/testsuite/g++.old-deja/g++.mike/net38.C +++ b/gcc/testsuite/g++.old-deja/g++.mike/net38.C @@ -1,28 +1 @@ -struct A { - virtual int a () { return 0; } -}; - -struct B { - virtual int b () { return 0; } - virtual int b2 () { return 0; } -}; - -struct C : public A, public B { - virtual int a () { return 1; } - virtual int b () { return 2; } - virtual int b2 () { return 3; } -}; - -int (C::*vmpb) () = &C::b; -int (C::*vmpb2) () = &C::b2; -int (C::*vmpa) () = &C::a; - -main () { - C c; - if ((c.*vmpa)() != 1) - return 1; - if ((c.*vmpb)() != 2) - return 1; - if ((c.*vmpb2)() != 3) - return 1; -} +int main () { diff --git a/gcc/testsuite/g++.old-deja/g++.mike/net41.C b/gcc/testsuite/g++.old-deja/g++.mike/net41.C index 6f02d3ce0f4..b3b753c1a91 100644 --- a/gcc/testsuite/g++.old-deja/g++.mike/net41.C +++ b/gcc/testsuite/g++.old-deja/g++.mike/net41.C @@ -1,3 +1 @@ -main() { - int i = ~ false; -} +int main() { diff --git a/gcc/testsuite/g++.old-deja/g++.mike/net43.C b/gcc/testsuite/g++.old-deja/g++.mike/net43.C index c2c789325d6..fca7aa3a92f 100644 --- a/gcc/testsuite/g++.old-deja/g++.mike/net43.C +++ b/gcc/testsuite/g++.old-deja/g++.mike/net43.C @@ -1,11 +1 @@ -// Build don't link: - -class foo { - public: - friend int operator ^(const foo&, const foo&); -}; - -main () -{ - int (*funptr) (const foo &, const foo &) = operator ^; -} +int main () diff --git a/gcc/testsuite/g++.old-deja/g++.mike/net45.C b/gcc/testsuite/g++.old-deja/g++.mike/net45.C index 6f9dc3a391b..cef8734d1e8 100644 --- a/gcc/testsuite/g++.old-deja/g++.mike/net45.C +++ b/gcc/testsuite/g++.old-deja/g++.mike/net45.C @@ -1,20 +1 @@ -// Build don't link: - -template <class T1, class T2> -struct pair { - T1 first; - T2 second; - pair(const T1& a, const T2& b) : first(a), second(b) {} -}; - -struct myint { - myint() { - } - myint(const myint& mi) { - } - operator=(const myint& mi) { - } -}; - -extern pair<const myint, myint> a; -pair<const myint, myint> b(a); + myint& operator=(const myint& mi) { diff --git a/gcc/testsuite/g++.old-deja/g++.mike/net46.C b/gcc/testsuite/g++.old-deja/g++.mike/net46.C index 235cbfb87e1..ac7950117f9 100644 --- a/gcc/testsuite/g++.old-deja/g++.mike/net46.C +++ b/gcc/testsuite/g++.old-deja/g++.mike/net46.C @@ -9,7 +9,7 @@ static void *operator new(size_t size) throw (std::bad_alloc) { return (void*) 0; } -main() { +int main() { cout << ""; new int; return fail; diff --git a/gcc/testsuite/g++.old-deja/g++.mike/net47.C b/gcc/testsuite/g++.old-deja/g++.mike/net47.C index 431ff22f1a0..dedb71e7a4a 100644 --- a/gcc/testsuite/g++.old-deja/g++.mike/net47.C +++ b/gcc/testsuite/g++.old-deja/g++.mike/net47.C @@ -1,8 +1 @@ -// Build don't link: -// Special g++ Options: -w - -class foo {}; -class bar : foo { -public: - bar () : () {} -}; +// Special g++ Options: -w -fpermissive diff --git a/gcc/testsuite/g++.old-deja/g++.mike/net8.C b/gcc/testsuite/g++.old-deja/g++.mike/net8.C index 62b4fedb569..fca7aa3a92f 100644 --- a/gcc/testsuite/g++.old-deja/g++.mike/net8.C +++ b/gcc/testsuite/g++.old-deja/g++.mike/net8.C @@ -1,32 +1 @@ -// Build don't link: -// Special g++ Options: -pedantic-errors - -class Base { -public: - int foo; -}; - -class Derived : public Base { -public: - int bar; -}; - -void func(Base&); // ERROR - - -void func2(const Derived& d) { - func(d); // ERROR - this is bad -} - -void -foo (int& a) -{ // ERROR - -} - -main () -{ - int b; - const int*const a = &b; - *a = 10; // ERROR - it's const - foo (*a); // ERROR - it's const - return 0; -} +int main () diff --git a/gcc/testsuite/g++.old-deja/g++.mike/net9.C b/gcc/testsuite/g++.old-deja/g++.mike/net9.C index c36151c88a9..7d876dc95f4 100644 --- a/gcc/testsuite/g++.old-deja/g++.mike/net9.C +++ b/gcc/testsuite/g++.old-deja/g++.mike/net9.C @@ -4,7 +4,7 @@ const int ci=10, *pc = &ci, *const cpc = pc, **ppc; int i, *p, *const cp = &i; -main() +int main() { ci = 1; // ERROR - bad ci++; // ERROR - bad diff --git a/gcc/testsuite/g++.old-deja/g++.mike/ns1.C b/gcc/testsuite/g++.old-deja/g++.mike/ns1.C index c9189270180..c347d2d93a4 100644 --- a/gcc/testsuite/g++.old-deja/g++.mike/ns1.C +++ b/gcc/testsuite/g++.old-deja/g++.mike/ns1.C @@ -1,11 +1,11 @@ namespace Foo { - bar() { + int bar() { return 0; } } using namespace Foo; -main() { +int main() { bar(); } diff --git a/gcc/testsuite/g++.old-deja/g++.mike/ns10.C b/gcc/testsuite/g++.old-deja/g++.mike/ns10.C index 2418004ba5e..a6b1c3aedd3 100644 --- a/gcc/testsuite/g++.old-deja/g++.mike/ns10.C +++ b/gcc/testsuite/g++.old-deja/g++.mike/ns10.C @@ -1,9 +1,9 @@ namespace Foo { - bar() { + int bar() { return 0; } } -main() { +int main() { return Foo::bar(); } diff --git a/gcc/testsuite/g++.old-deja/g++.mike/ns11.C b/gcc/testsuite/g++.old-deja/g++.mike/ns11.C index e69de29bb2d..a25b7878e68 100644 --- a/gcc/testsuite/g++.old-deja/g++.mike/ns11.C +++ b/gcc/testsuite/g++.old-deja/g++.mike/ns11.C @@ -0,0 +1,3 @@ + int bar() { + int mymain() { +int main() { diff --git a/gcc/testsuite/g++.old-deja/g++.mike/ns2.C b/gcc/testsuite/g++.old-deja/g++.mike/ns2.C index 30a263d43c6..365eb8c0923 100644 --- a/gcc/testsuite/g++.old-deja/g++.mike/ns2.C +++ b/gcc/testsuite/g++.old-deja/g++.mike/ns2.C @@ -4,6 +4,6 @@ namespace N { using namespace N; -main() { +int main() { return i; } diff --git a/gcc/testsuite/g++.old-deja/g++.mike/ns9.C b/gcc/testsuite/g++.old-deja/g++.mike/ns9.C index e69de29bb2d..27a0f186ad6 100644 --- a/gcc/testsuite/g++.old-deja/g++.mike/ns9.C +++ b/gcc/testsuite/g++.old-deja/g++.mike/ns9.C @@ -0,0 +1,2 @@ + int bar() { +int main() { diff --git a/gcc/testsuite/g++.old-deja/g++.mike/opr-as1.C b/gcc/testsuite/g++.old-deja/g++.mike/opr-as1.C index 38795b5ba24..b3b753c1a91 100644 --- a/gcc/testsuite/g++.old-deja/g++.mike/opr-as1.C +++ b/gcc/testsuite/g++.old-deja/g++.mike/opr-as1.C @@ -1,11 +1 @@ -// Shows a problem with the default op= not being an implementation... - -class C { - int i; -}; - -C a, b; - -main() { - a = b; -} +int main() { diff --git a/gcc/testsuite/g++.old-deja/g++.mike/opr-dot1.C b/gcc/testsuite/g++.old-deja/g++.mike/opr-dot1.C index e709057c33a..d5d88e10c74 100644 --- a/gcc/testsuite/g++.old-deja/g++.mike/opr-dot1.C +++ b/gcc/testsuite/g++.old-deja/g++.mike/opr-dot1.C @@ -1,22 +1 @@ -// Build don't link: - -typedef struct base1 { - int x; -} base1_t; - -typedef struct base2 { - int x; -} base2_t; - -class derived1 : public base1 { -}; - -class derived2 : public derived1, public base2 { -}; - -struct test { - derived2& fails; - test1() { - fails.base1::x = 5; - } -}; + void test1() { diff --git a/gcc/testsuite/g++.old-deja/g++.mike/p10148.C b/gcc/testsuite/g++.old-deja/g++.mike/p10148.C index 36309763fde..b3b753c1a91 100644 --- a/gcc/testsuite/g++.old-deja/g++.mike/p10148.C +++ b/gcc/testsuite/g++.old-deja/g++.mike/p10148.C @@ -1,33 +1 @@ -// prms-id: 10148 - -int fail = 1; -void ok() { fail = 0; } - -class TC { - int s_; -}; - -class TIRD { - public: - void (*itc)(); - TIRD() { itc = ok; } -}; - -class TCCB : public TC, public TIRD { -}; - -class TCRCB : public TCCB { -public: - virtual void eat (); -}; - -void TCRCB::eat () { - void *vp = (TIRD*)this->itc; - this->itc(); -} - -main() { - TCRCB a; - a.eat(); - return fail; -} +int main() { diff --git a/gcc/testsuite/g++.old-deja/g++.mike/p10769a.C b/gcc/testsuite/g++.old-deja/g++.mike/p10769a.C index c0bd36c6269..f5ff345a3fd 100644 --- a/gcc/testsuite/g++.old-deja/g++.mike/p10769a.C +++ b/gcc/testsuite/g++.old-deja/g++.mike/p10769a.C @@ -9,7 +9,7 @@ class A { public: void f1a() { ok += 3; } void f1b() { ok += 5; } - void f2a() { ok += 7; } + void f2a() { ok += 7; } // gets bogus error XFAIL *-*-* void f2b() { } const static void (*table[2][2])(); void main(); @@ -31,7 +31,7 @@ void A::main() { void (A::*mPtr)() = &A::f1a; (*(void (*)(A*))PMF2PF(mPtr))(&a); - (*(void (*)(A*))PMF2PF(f2a))(&a); + (*(void (*)(A*))PMF2PF(f2a))(&a); // gets bogus error XFAIL *-*-* } int main() { @@ -40,6 +40,6 @@ int main() { void (A::*mPtr)() = &A::f1b; (*(void (*)(A*))PMF2PF(a.*mPtr))(&a); - (*(void (*)(A*))PMF2PF(a.f2a))(&a); + (*(void (*)(A*))PMF2PF(a.f2a))(&a); // gets bogus error XFAIL *-*-* return ok != 3+3+5+5+7+7; } diff --git a/gcc/testsuite/g++.old-deja/g++.mike/p10849a.C b/gcc/testsuite/g++.old-deja/g++.mike/p10849a.C index a5c377312a1..d6d46569b87 100644 --- a/gcc/testsuite/g++.old-deja/g++.mike/p10849a.C +++ b/gcc/testsuite/g++.old-deja/g++.mike/p10849a.C @@ -27,7 +27,7 @@ struct D : public B, public C D() : B(41), C(42) { } } d; -main() { +int main() { if (! d.g()) return 1; } diff --git a/gcc/testsuite/g++.old-deja/g++.mike/p1248.C b/gcc/testsuite/g++.old-deja/g++.mike/p1248.C index 3db677c5b80..29b55ae70ac 100644 --- a/gcc/testsuite/g++.old-deja/g++.mike/p1248.C +++ b/gcc/testsuite/g++.old-deja/g++.mike/p1248.C @@ -1,28 +1 @@ -// GROUPS passed pure-virt -extern "C" { void printf(const char *, ...); } -class Base { -public: - virtual ~Base() =0; -}; - -class Deranged : public Base { -public: - int value; - virtual ~Deranged(); -}; - - -Deranged::~Deranged(){} - -void foo() { - Deranged d; -} - -main() -{ - foo(); - printf("PASS\n"); - return 0; -} - -Base::~Base () { } +int main() diff --git a/gcc/testsuite/g++.old-deja/g++.mike/p1567.C b/gcc/testsuite/g++.old-deja/g++.mike/p1567.C index c805818e0ea..0b35bd972e0 100644 --- a/gcc/testsuite/g++.old-deja/g++.mike/p1567.C +++ b/gcc/testsuite/g++.old-deja/g++.mike/p1567.C @@ -29,7 +29,7 @@ public: const char* f3() { return A::f3(); } }; -main() { +int main() { C* tempC = new C; D* tempD = new D; A* a = tempC; diff --git a/gcc/testsuite/g++.old-deja/g++.mike/p16146.C b/gcc/testsuite/g++.old-deja/g++.mike/p16146.C index 2fd95e52bd7..070dc2ea4b8 100644 --- a/gcc/testsuite/g++.old-deja/g++.mike/p16146.C +++ b/gcc/testsuite/g++.old-deja/g++.mike/p16146.C @@ -81,7 +81,7 @@ public: void j () {}; }; -main () { +int main () { firstBase* fbp = new classImplementation; classImplementation* cip = dynamic_cast <classImplementation*> (fbp); cip->addRef(); diff --git a/gcc/testsuite/g++.old-deja/g++.mike/p1862.C b/gcc/testsuite/g++.old-deja/g++.mike/p1862.C index ff7266f150c..401b3700777 100644 --- a/gcc/testsuite/g++.old-deja/g++.mike/p1862.C +++ b/gcc/testsuite/g++.old-deja/g++.mike/p1862.C @@ -45,7 +45,7 @@ public: } }; -main() +int main() { C1 *one = new C1; diff --git a/gcc/testsuite/g++.old-deja/g++.mike/p2736.C b/gcc/testsuite/g++.old-deja/g++.mike/p2736.C index 0ef5b3a0001..b3b753c1a91 100644 --- a/gcc/testsuite/g++.old-deja/g++.mike/p2736.C +++ b/gcc/testsuite/g++.old-deja/g++.mike/p2736.C @@ -1,28 +1 @@ -// This is a poor test case, it is meant to ensure that function local -// statics are destroyed at the right time. See PR 2736 for details. -// prms-id: 2736 - -int count; - -struct A { - int which; - A(int i) :which(i) { - // printf("ctor %x\n", this); - } - ~A() { - // printf("dtor %x\n", this); - if (++count != which) - abort (); - } -}; - -void -foo() { - static A a(1); -} - -A a(2); - -main() { - foo(); -} +int main() { diff --git a/gcc/testsuite/g++.old-deja/g++.mike/p2846.C b/gcc/testsuite/g++.old-deja/g++.mike/p2846.C index 953e80037b8..fca7aa3a92f 100644 --- a/gcc/testsuite/g++.old-deja/g++.mike/p2846.C +++ b/gcc/testsuite/g++.old-deja/g++.mike/p2846.C @@ -1,55 +1 @@ -// prms-id: 2846 - -extern "C" int printf(const char *, ...); -extern "C" void exit(int); - -class A; -class B; - -class A { -public: - - A(void){} - A(const A&){} - A(const B&); - - virtual ~A(void){} - - virtual void print(void) const { - printf("A::print\n"); - printf("FAIL\n"); - exit(1); - } - B compute(void) const; -}; - -class B : private A { -friend class A; -public: - - virtual ~B(void){} - - void print(void) const { - printf("B::print\n"); - } - -private: - B(const A& x, int){} -}; - -A::A(const B& s) { - s.print(); -} - -B A::compute(void) const { - B sub(*this, 1); - return sub; -} - -main () -{ - A titi; - A toto = titi.compute(); - printf("PASS\n"); - return 0; -} +int main () diff --git a/gcc/testsuite/g++.old-deja/g++.mike/p2846a.C b/gcc/testsuite/g++.old-deja/g++.mike/p2846a.C index 363ed5b0177..765014bc66d 100644 --- a/gcc/testsuite/g++.old-deja/g++.mike/p2846a.C +++ b/gcc/testsuite/g++.old-deja/g++.mike/p2846a.C @@ -1,34 +1 @@ -// Shows that problem of initializing one object's vtable pointer from -// another object's vtable pointer when doing a default copy of it -// and the vtable pointer involved is the main one. - -// Correct answer is B::print. -// g++ prints D::print, which is wrong. Cfront gets is right. - -// prms-id: 2846 - -extern "C" int printf(const char *, ...); -extern "C" void exit(int); - -class B { -public: - virtual void print(void) const { printf("B::print\n"); } -}; - -class D : public B { -public: - void print(void) const { printf("D::print\n"); exit(1); } - B compute(void) const; -}; - -B D::compute(void) const -{ - B sub(*(B*)this); - return sub; -} - -main () { - D titi; - titi.compute().print(); - return 0; -} +int main () { diff --git a/gcc/testsuite/g++.old-deja/g++.mike/p2846b.C b/gcc/testsuite/g++.old-deja/g++.mike/p2846b.C index 0fb8217456e..fca7aa3a92f 100644 --- a/gcc/testsuite/g++.old-deja/g++.mike/p2846b.C +++ b/gcc/testsuite/g++.old-deja/g++.mike/p2846b.C @@ -1,52 +1 @@ -// Shows that problem of initializing one object's secondary base from -// another object via a user defined copy constructor for that base, -// the pointer for the secondary vtable is not set after implicit -// copying of the outer class, but rather has the pointer to the main -// vtable for the secondary base left over from the user defined copy -// constructor for that base. - -// Correct answer is B::beefy. -// g++ prints A::beefy, which is wrong. Cfront gets it right. - -// prms-id: 2846 - -extern "C" int printf(const char *, ...); -extern "C" void exit(int); - -class B; - -class A { - public: - - A(void){} - A(const A&){} - - virtual void print(void) const { } - B compute(void) const; -}; - -class C { -public: - C() { } - C(C& o) { } // with it, things are wrong, without it, they're ok - virtual void beefy(void) const { printf("A::beefy\n"); exit(1); } -}; - -class B : private A, public C { -public: - B(const A& x, int){} - void beefy(void) const { printf("B::beefy\n"); } -}; - -B A::compute(void) const -{ - B sub(*this, 1); - return sub; -} - -main () -{ - A titi; - titi.compute().beefy(); - return 0; -} +int main () diff --git a/gcc/testsuite/g++.old-deja/g++.mike/p2960.C b/gcc/testsuite/g++.old-deja/g++.mike/p2960.C index f7c88d9843c..b3b753c1a91 100644 --- a/gcc/testsuite/g++.old-deja/g++.mike/p2960.C +++ b/gcc/testsuite/g++.old-deja/g++.mike/p2960.C @@ -1,30 +1 @@ -// prms-id: 2960 - -extern "C" int printf(const char *, ...); - -class Test0 { -public: - virtual void f0() { } // works fine if this virtual removed -}; - -class Test1 : public Test0 { -public: - void f1() { f2(); } // generates bus error here - virtual void f2() { printf("Test1::f2\n"); } -}; - -class Test2 { -public: - virtual void f3() { } -}; - -class Test3 : public Test2, public Test1 { // works fine if Test1 first -public: - virtual ~Test3() { f1(); } // calling f2 directly works - virtual void f2() { printf("Test3::f2\n"); } -}; - -main() { - Test3 t3; - return 0; -} +int main() { diff --git a/gcc/testsuite/g++.old-deja/g++.mike/p3041.C b/gcc/testsuite/g++.old-deja/g++.mike/p3041.C index c059c0e6cdb..29b55ae70ac 100644 --- a/gcc/testsuite/g++.old-deja/g++.mike/p3041.C +++ b/gcc/testsuite/g++.old-deja/g++.mike/p3041.C @@ -1,33 +1 @@ -// prms-id: 3041 - -class A { -public: - A() { } - virtual void a() = 0; - static int b(A * p) { - p->a(); - return 1; - } -}; - -class B : virtual public A { -public: - B() { - static int installed = b(this); - } - void a() { } -}; - -class C : virtual public B { -public: - C() { - static int installed = b(this); - } - void a() { } -}; - -main() -{ - C c; - return 0; -} +int main() diff --git a/gcc/testsuite/g++.old-deja/g++.mike/p3060d.C b/gcc/testsuite/g++.old-deja/g++.mike/p3060d.C index 2813d66c871..b3b753c1a91 100644 --- a/gcc/testsuite/g++.old-deja/g++.mike/p3060d.C +++ b/gcc/testsuite/g++.old-deja/g++.mike/p3060d.C @@ -1,34 +1 @@ -// This is a test case to make sure the explicit cast on a pointer to -// a member function works ok. -// prms-id: 3060 - -extern "C" int printf(const char *, ...); - -class Object; - -typedef void (Object::*VoidObjMemberFunc)(Object *, ...); - -class Object { -public: - int foo; -}; - -class Clipper: public Object { -public: - int bar; - void Feedback(Object*, void*); -}; -void Clipper::Feedback(Object *tracker, void *ap) { - printf("Doing feedback\n"); -} - -void vfunc(VoidObjMemberFunc of, Object *op, void *v1) { - (op->*of)(op, v1); -} - -main() { - Object o; - - vfunc((VoidObjMemberFunc)&Clipper::Feedback, &o, 0); - return 0; -} +int main() { diff --git a/gcc/testsuite/g++.old-deja/g++.mike/p3068.C b/gcc/testsuite/g++.old-deja/g++.mike/p3068.C index 52c5cd56de3..b3b753c1a91 100644 --- a/gcc/testsuite/g++.old-deja/g++.mike/p3068.C +++ b/gcc/testsuite/g++.old-deja/g++.mike/p3068.C @@ -1,60 +1 @@ -// prms-id: 3068 - -extern "C" int printf(const char *, ...); -extern "C" void exit(int); - -class LB { -public: - virtual int test() { return 0; } - virtual ~LB() { } -protected: - LB() { } -}; - -class RRB { -public: - virtual ~RRB() { } - virtual void test2(int a) { } -}; - -class RR : public RRB { -public: - virtual ~RR() { } -}; - -class RL { -public: - virtual void real(int a) { - printf("RL::real\n"); - } -}; - - -class R : public RL, public RR { -public: - virtual void test3(int a) { } - virtual void test2(int a) { } -}; - -class L : public LB { -}; - -class C : public L, public R { -public: - C() { } - virtual ~C() { - printf("C::~C\n"); - exit(1); - } - virtual void real(int a) { - printf("RL::real\n"); - } -}; - -main() { - C& bb = *new C; - R& mv = bb; - bb.real(0); - mv.real(0); - return 0; -} +int main() { diff --git a/gcc/testsuite/g++.old-deja/g++.mike/p3139.C b/gcc/testsuite/g++.old-deja/g++.mike/p3139.C index 9ff9b23cfa5..b3b753c1a91 100644 --- a/gcc/testsuite/g++.old-deja/g++.mike/p3139.C +++ b/gcc/testsuite/g++.old-deja/g++.mike/p3139.C @@ -1,25 +1 @@ -// prms-id: 3139 - -extern "C" int printf(const char *, ...); - -class A { - public: - A() { } - virtual int a() = 0; -}; - -class B : virtual public A { - public: - virtual int a() = 0; -}; - -class C : public B { - public: - int a() { return 42; } -}; - -main() { - B * b = new C; - printf("%d.\n", b->a()); - return 0; -} +int main() { diff --git a/gcc/testsuite/g++.old-deja/g++.mike/p3570.C b/gcc/testsuite/g++.old-deja/g++.mike/p3570.C index abccf793cb6..fca7aa3a92f 100644 --- a/gcc/testsuite/g++.old-deja/g++.mike/p3570.C +++ b/gcc/testsuite/g++.old-deja/g++.mike/p3570.C @@ -1,29 +1 @@ -// prms-id: 3570 - -extern "C" int printf(const char *, ...); - -struct A { - void print() {printf("A");}; -}; - -struct B : A { - typedef A superB; - void print() {superB::print(); printf("B");}; -}; - -struct C : B { - typedef B superC; - void print() {superC::print(); printf("C");}; -}; - -main () -{ - A a; - B b; - C c; - - a.print(); printf("\n"); - b.print(); printf("\n"); - c.print(); printf("\n"); - return 0; -} +int main () diff --git a/gcc/testsuite/g++.old-deja/g++.mike/p3708.C b/gcc/testsuite/g++.old-deja/g++.mike/p3708.C index 2f5e401e56d..a6d00e8ef89 100644 --- a/gcc/testsuite/g++.old-deja/g++.mike/p3708.C +++ b/gcc/testsuite/g++.old-deja/g++.mike/p3708.C @@ -1,86 +1,4 @@ -// prms-id: 3708 - -extern "C" void printf (char *, ...); -extern "C" int atoi (char *); - -void *ptr; - -class A { -public: - A() { printf ("A is constructed.\n"); } - virtual xx(int doit) { printf ("A is destructed.\n"); } -}; - -class A1 { -public: - A1() { printf ("A1 is constructed.\n"); } - virtual xx(int doit) { printf ("A1 is destructed.\n"); } -}; - -class B : public virtual A, public A1 { -public: - B() { printf ("B is constructed.\n"); } - virtual xx(int doit) { - printf ("B is destructed.\n"); - A1::xx (1); - if (doit) A::xx (1); - } -}; - -int num; - -class C : public virtual A, public B { -public: - C() { ++num; printf ("C is constructed.\n"); - ptr = this; - } - virtual xx(int doit) { - --num; - if (ptr != this) - printf("FAIL\n%x != %x\n", ptr, this); - printf ("C is destructed.\n"); - B::xx (0); - if (doit) A::xx (1); - } -}; - -void fooA(A *a) { - printf ("Casting to A!\n"); - a->xx (1); -} -void fooA1(A1 *a) { - printf ("Casting to A1!\n"); - a->xx (1); -} - -void fooB(B *b) { - printf ("Casting to B!\n"); - b->xx (1); -} - -void fooC(C *c) { - printf ("Casting to C!\n"); - c->xx (1); -} - -int main(int argc, char *argv[]) { - printf ("*** Construct C object!\n"); - C *c = new C(); - - int i = 0; - - printf ("*** Try to delete the casting pointer!\n"); - switch (i) - { - case 0: fooA1(c); - break; - case 1: fooA(c); - break; - case 2: fooB(c); - break; - case 3: fooC(c); - break; - } - - return num!=0; -} + virtual void xx(int doit) { printf ("A is destructed.\n"); } + virtual void xx(int doit) { printf ("A1 is destructed.\n"); } + virtual void xx(int doit) { + virtual void xx(int doit) { diff --git a/gcc/testsuite/g++.old-deja/g++.mike/p3708a.C b/gcc/testsuite/g++.old-deja/g++.mike/p3708a.C index 1fecb16be36..a6d00e8ef89 100644 --- a/gcc/testsuite/g++.old-deja/g++.mike/p3708a.C +++ b/gcc/testsuite/g++.old-deja/g++.mike/p3708a.C @@ -1,86 +1,4 @@ -// prms-id: 3708 - -extern "C" void printf (char *, ...); -extern "C" int atoi (char *); - -void *ptr; - -class A { -public: - A() { printf ("A is constructed.\n"); } - virtual xx(int doit) { printf ("A is destructed.\n"); } -}; - -class A1 { -public: - A1() { printf ("A1 is constructed.\n"); } - virtual xx(int doit) { printf ("A1 is destructed.\n"); } -}; - -class B : public A1, public virtual A { -public: - B() { printf ("B is constructed.\n"); } - virtual xx(int doit) { - printf ("B is destructed.\n"); - A1::xx (1); - if (doit) A::xx (1); - } -}; - -int num; - -class C : public virtual A, public B { -public: - C() { ++num; printf ("C is constructed.\n"); - ptr = this; - } - virtual xx(int doit) { - --num; - if (ptr != this) - printf("FAIL\n%x != %x\n", ptr, this); - printf ("C is destructed.\n"); - B::xx (0); - if (doit) A::xx (1); - } -}; - -void fooA(A *a) { - printf ("Casting to A!\n"); - a->xx (1); -} -void fooA1(A1 *a) { - printf ("Casting to A1!\n"); - a->xx (1); -} - -void fooB(B *b) { - printf ("Casting to B!\n"); - b->xx (1); -} - -void fooC(C *c) { - printf ("Casting to C!\n"); - c->xx (1); -} - -int main(int argc, char *argv[]) { - printf ("*** Construct C object!\n"); - C *c = new C(); - - int i = 0; - - printf ("*** Try to delete the casting pointer!\n"); - switch (i) - { - case 0: fooA1(c); - break; - case 1: fooA(c); - break; - case 2: fooB(c); - break; - case 3: fooC(c); - break; - } - - return num!=0; -} + virtual void xx(int doit) { printf ("A is destructed.\n"); } + virtual void xx(int doit) { printf ("A1 is destructed.\n"); } + virtual void xx(int doit) { + virtual void xx(int doit) { diff --git a/gcc/testsuite/g++.old-deja/g++.mike/p3708b.C b/gcc/testsuite/g++.old-deja/g++.mike/p3708b.C index dddb77c2e51..d7e629719c4 100644 --- a/gcc/testsuite/g++.old-deja/g++.mike/p3708b.C +++ b/gcc/testsuite/g++.old-deja/g++.mike/p3708b.C @@ -1,85 +1,5 @@ -// prms-id: 3708 - -extern "C" void printf (char *, ...); -extern "C" void exit(int); - -void *ptr; - -class A { -public: - A() { printf ("A is constructed.\n"); } - virtual xx(int doit) { printf ("A is destructed.\n"); } -}; - -class A1 { -public: - A1() { printf ("A1 is constructed.\n"); } - virtual xx(int doit) { printf ("A1 is destructed.\n"); } -}; - -class B : public virtual A, public A1 { -public: - B() { printf ("B is constructed.\n"); } - virtual xx(int doit) { - printf ("B is destructed.\n"); - A1::xx (1); - if (doit) A::xx (1); - } -}; - -int num; - -class C : public virtual A { -public: - C() { printf ("C is constructed.\n"); - } - virtual xx(int doit) { - printf ("C is destructed.\n"); - if (doit) A::xx (1); - } -}; - -class D : public C, public B { -public: - D() { ++num; printf ("D is constructed.\n"); - ptr = this; - } - virtual xx(int doit) { - --num; - if (ptr != this) { - printf("FAIL\n%x != %x\n", ptr, this); - exit(1); - } - printf ("D is destructed.\n"); - C::xx (0); - B::xx (0); - } -}; - -void fooA(A *a) { - printf ("Casting to A!\n"); - a->xx (1); -} -void fooA1(A1 *a) { - printf ("Casting to A1!\n"); - a->xx (1); -} - -void fooB(B *b) { - printf ("Casting to B!\n"); - b->xx (1); -} - -void fooC(C *c) { - printf ("Casting to C!\n"); - c->xx (1); -} - -int main(int argc, char *argv[]) { - printf ("*** Construct D object!\n"); - D *d = new D(); - - printf ("*** Try to delete the casting pointer!\n"); - fooA1(d); - return num!=0; -} + virtual void xx(int doit) { printf ("A is destructed.\n"); } + virtual void xx(int doit) { printf ("A1 is destructed.\n"); } + virtual void xx(int doit) { + virtual void xx(int doit) { + virtual void xx(int doit) { diff --git a/gcc/testsuite/g++.old-deja/g++.mike/p4068.C b/gcc/testsuite/g++.old-deja/g++.mike/p4068.C index e2531ed81fe..b3b753c1a91 100644 --- a/gcc/testsuite/g++.old-deja/g++.mike/p4068.C +++ b/gcc/testsuite/g++.old-deja/g++.mike/p4068.C @@ -1,22 +1 @@ -// prms-id: 4068 - -struct A { - A(); - typedef void (A::*F)(); - void d(); - void foo() { } - F& f() { return f_; } - F f_; -}; - -A::A() : f_(&A::foo) { -} - -void A::d() { - (this->*(f()))(); -} - -main() { - A a; - a.d(); -} +int main() { diff --git a/gcc/testsuite/g++.old-deja/g++.mike/p4173.C b/gcc/testsuite/g++.old-deja/g++.mike/p4173.C index a5b11f226d2..4f388e32cbc 100644 --- a/gcc/testsuite/g++.old-deja/g++.mike/p4173.C +++ b/gcc/testsuite/g++.old-deja/g++.mike/p4173.C @@ -1,24 +1,2 @@ -// This error happens because lvalue is not done well in the C++ front-end. -// NOPs should be lvalues if their arguments are. -// NON_LVALUE_EXPRs shouldn't be. -// Special g++ Options: -Wall -ansi -pedantic-errors -// Build don't link: -// prms-id: 4173 - -enum TypeKind { - RecordTypeKind -}; -struct Type -{ - enum TypeKind kind : 8; - unsigned char prefixLen; -}; - -Type a; -Type b; -TypeKind c; -main() { - a.kind = b.kind = c; - (a.kind = c) = b.kind; // gets bogus error -} +int diff --git a/gcc/testsuite/g++.old-deja/g++.mike/p4246.C b/gcc/testsuite/g++.old-deja/g++.mike/p4246.C index 1eb6668e969..61e680d3728 100644 --- a/gcc/testsuite/g++.old-deja/g++.mike/p4246.C +++ b/gcc/testsuite/g++.old-deja/g++.mike/p4246.C @@ -1,48 +1,5 @@ -// prms-id: 4246 - -extern "C" void abort (); -int num_d; - -class A -{ - public: - A() { } - virtual ~A() { } - virtual id() { } -}; - -class B -{ - public: - B() { } - virtual ~B() { } - virtual id() { } -}; - -class C : public A, public B -{ - public: - C() { } - virtual ~C() { } - id() { abort(); } -}; - -class D : public C -{ - public: - D() { ++num_d; } - virtual ~D() { -- num_d; } - id() { } -}; - -main() -{ - D* dp2 = new D; - ((B*)dp2)->id(); - delete (B*) dp2; - - B* bp1 = new D; - bp1->id(); - delete bp1; - return num_d != 0; -} + virtual void id() { } + virtual void id() { } + void id() { abort(); } + void id() { } +int main() diff --git a/gcc/testsuite/g++.old-deja/g++.mike/p4511.C b/gcc/testsuite/g++.old-deja/g++.mike/p4511.C index a3c83105bb9..b3b753c1a91 100644 --- a/gcc/testsuite/g++.old-deja/g++.mike/p4511.C +++ b/gcc/testsuite/g++.old-deja/g++.mike/p4511.C @@ -1,33 +1 @@ -// prms-id: 4511 - -int bad; - -class A { -public: - virtual void dummy (){}; -}; - -class B { -public: - virtual void f(void) = 0; -}; - -class C : public A, public B { -public: - void f(void) { bad=1; }; -}; - -class D : public C { -public: - void f(void) { }; -}; - -class E : public D { }; - -main() { - E e; - e.f(); - E * ep = &e; - ep->f(); - return bad; -} +int main() { diff --git a/gcc/testsuite/g++.old-deja/g++.mike/p4619.C b/gcc/testsuite/g++.old-deja/g++.mike/p4619.C index b401d7dda17..b3b753c1a91 100644 --- a/gcc/testsuite/g++.old-deja/g++.mike/p4619.C +++ b/gcc/testsuite/g++.old-deja/g++.mike/p4619.C @@ -1,10 +1 @@ -// Build don't link: -// prms-id: 4619 - -main() { - int i = 3; - int (*p)[10] = new int [20][10]; - int (*p1)[5][7][13][10] = new int [i][5][7][13][10]; - delete [] p1; - delete [] p; -} +int main() { diff --git a/gcc/testsuite/g++.old-deja/g++.mike/p4623.C b/gcc/testsuite/g++.old-deja/g++.mike/p4623.C index c96388de6d2..b3b753c1a91 100644 --- a/gcc/testsuite/g++.old-deja/g++.mike/p4623.C +++ b/gcc/testsuite/g++.old-deja/g++.mike/p4623.C @@ -1,35 +1 @@ -// prms-id: 4623 - -class base { -public: - int b_data; - base( int i=0 ) { b_data = i; } - void b_print() { } -}; - -class base1: virtual public base { -public: - int b1_data; - base1( int i = 0 ) { b1_data = i; b_data++; } - void b1_print() { } -}; - -class base2: virtual public base { -public: - int b2_data; - base2( int i = 0 ) { b2_data = i; b_data++; } - void b2_print() { } -}; - -class base3: public base {}; - -class derived: public base3, public base1, public base2 { -public: - int d_data; - derived( int i ) { d_data = i; base3::b_data++; } - void d_print() { } -}; - -main() { - derived d(1); d.d_print(); return 0; -} +int main() { diff --git a/gcc/testsuite/g++.old-deja/g++.mike/p4693.C b/gcc/testsuite/g++.old-deja/g++.mike/p4693.C index 09e1333933e..b3b753c1a91 100644 --- a/gcc/testsuite/g++.old-deja/g++.mike/p4693.C +++ b/gcc/testsuite/g++.old-deja/g++.mike/p4693.C @@ -1,24 +1 @@ -// Build don't link: -// prms-id: 4693 - -class a { -public: - virtual ~a(); -}; - -class b { -public: - virtual void set_var() = 0; -}; - -class c : public b, public a { }; - -class d : public c { -public: - void set_var() { } -}; - -main() { - d * test; - test = new d; -} +int main() { diff --git a/gcc/testsuite/g++.old-deja/g++.mike/p4736b.C b/gcc/testsuite/g++.old-deja/g++.mike/p4736b.C index 19d655c6f09..b3b753c1a91 100644 --- a/gcc/testsuite/g++.old-deja/g++.mike/p4736b.C +++ b/gcc/testsuite/g++.old-deja/g++.mike/p4736b.C @@ -1,48 +1 @@ -// prms-id: 4736 - -class Rep { -public: - virtual int foo() { return 1; } -}; - -class Rep_1 : public Rep { -}; - -class VBaseMain { -public: - virtual int foo() { return 2; } -}; - -class OtherVBase { -public: - virtual int foo() { return 3; } -}; - -class Rep_2 : public Rep { -}; - -class DVBase : public VBaseMain, public Rep_2, public OtherVBase { -public: - virtual int foo() { return 4; } -}; - -class Main : public Rep_1, virtual public DVBase { -public: - virtual int foo() { return 5; } -}; - -main() { - Main m; - if (m.foo() != 5) - return 1; - if (((Rep*)(Rep_1*)&m)->foo() != 5) - return 2; - if (((DVBase*)&m)->foo() != 5) - return 3; - if (((VBaseMain*)(DVBase*)&m)->foo() != 5) - return 4; - if (((Rep*)(Rep_2*)(DVBase*)&m)->foo() != 5) - return 5; - if (((OtherVBase*)(DVBase*)&m)->foo() != 5) - return 6; -} +int main() { diff --git a/gcc/testsuite/g++.old-deja/g++.mike/p4736c.C b/gcc/testsuite/g++.old-deja/g++.mike/p4736c.C index de5e4b6962c..b3b753c1a91 100644 --- a/gcc/testsuite/g++.old-deja/g++.mike/p4736c.C +++ b/gcc/testsuite/g++.old-deja/g++.mike/p4736c.C @@ -1,62 +1 @@ -// prms-id: 4736 - -int did_fail; - -class Rep { -public: - virtual ~Rep() { } -}; - -class Rep_1 : public Rep { -}; - -class VBaseMain { -public: - virtual ~VBaseMain() { } -}; - -class OtherVBase { -public: - virtual ~OtherVBase() { } -}; - -class Rep_2 : public Rep { -}; - -class DVBase : public VBaseMain, public Rep_2, public OtherVBase { -public: - virtual ~DVBase() { } -}; - -class Main : public Rep_1, virtual public DVBase { -public: - virtual ~Main() { did_fail = 0; } -}; - -main() { - Main* m; - did_fail = 1; - delete new Main; - if (did_fail) - return 1; - did_fail = 1; - delete (Rep*)(Rep_1*)new Main; - if (did_fail) - return 2; - did_fail = 1; - delete (DVBase*)new Main; - if (did_fail) - return 3; - did_fail = 1; - delete (VBaseMain*)(DVBase*)new Main; - if (did_fail) - return 4; - did_fail = 1; - delete (Rep*)(Rep_2*)(DVBase*)new Main; - if (did_fail) - return 5; - did_fail = 1; - delete (OtherVBase*)(DVBase*)new Main; - if (did_fail) - return 6; -} +int main() { diff --git a/gcc/testsuite/g++.old-deja/g++.mike/p5469.C b/gcc/testsuite/g++.old-deja/g++.mike/p5469.C index 3f5029dc3ce..b3b753c1a91 100644 --- a/gcc/testsuite/g++.old-deja/g++.mike/p5469.C +++ b/gcc/testsuite/g++.old-deja/g++.mike/p5469.C @@ -1,21 +1 @@ -// prms-id: 5469 - -int count; - -class A { - A(); - A(const A&); -public: - A(int) { ++count; } - ~A() { --count; } - int operator== (const A& r) { return 0; } -}; - -main() { - { - A a (1); - if (a == 2 && a == 1) - ; - } - return count; -} +int main() { diff --git a/gcc/testsuite/g++.old-deja/g++.mike/p5469a.C b/gcc/testsuite/g++.old-deja/g++.mike/p5469a.C index efcd2f4b652..b3b753c1a91 100644 --- a/gcc/testsuite/g++.old-deja/g++.mike/p5469a.C +++ b/gcc/testsuite/g++.old-deja/g++.mike/p5469a.C @@ -1,21 +1 @@ -// prms-id: 5469 - -int count; - -class A { - A(); - A(const A&); -public: - A(int) { ++count; } - ~A() { --count; } - int operator== (const A& r) { return 1; } -}; - -main() { - { - A a (1); - if (a == 2 || a == 1) - ; - } - return count; -} +int main() { diff --git a/gcc/testsuite/g++.old-deja/g++.mike/p5571.C b/gcc/testsuite/g++.old-deja/g++.mike/p5571.C index d9a3a471dd8..1cc419954e9 100644 --- a/gcc/testsuite/g++.old-deja/g++.mike/p5571.C +++ b/gcc/testsuite/g++.old-deja/g++.mike/p5571.C @@ -1,70 +1,2 @@ -// prms-id: 5571 - -int err = 0; -void *vp = 0; - -class ParentOne { -public: - ParentOne() {}; -#ifdef MAKE_WORK - virtual ~ParentOne() {}; -#endif -private: - char SomeData[101]; -}; - -class ParentTwo { -public: - ParentTwo() {}; - virtual ~ParentTwo() {}; -private: - int MoreData[12]; - virtual foo() { return 0; } -}; - -struct Child : public ParentOne, public ParentTwo { - int ChildsToy; - virtual void PrintThis() = 0; -}; - -struct Student : public Child { - int StudentsBook; - void PrintThis() { - if (vp == 0) - vp = (void *)this; - else - { - if (vp != (void *)this) - ++err; - } - } - void LocalPrintThis() { - if (vp == 0) - vp = (void *)this; - else - { - if (vp != (void *)this) - ++err; - } - PrintThis(); - } - void ForcedPrintThis() { - if (vp == 0) - vp = (void *)this; - else - { - if (vp != (void *)this) - ++err; - } - Student::PrintThis(); - } -}; - -main() { - Student o; - o.LocalPrintThis(); - o.ForcedPrintThis(); - Child* pX = &o; - pX->PrintThis(); - return err; -} + virtual int foo() { return 0; } +int main() { diff --git a/gcc/testsuite/g++.old-deja/g++.mike/p5673.C b/gcc/testsuite/g++.old-deja/g++.mike/p5673.C index 8d29191861e..b3b753c1a91 100644 --- a/gcc/testsuite/g++.old-deja/g++.mike/p5673.C +++ b/gcc/testsuite/g++.old-deja/g++.mike/p5673.C @@ -1,20 +1 @@ -// prms-id: 5673 - -class A { -public: - operator int () { - return 7; - } - ~A(); -}; - -int foo() { - return A(); -} - -main() { - return foo() != 7; -} - -A::~A() { -} +int main() { diff --git a/gcc/testsuite/g++.old-deja/g++.mike/p5840.C b/gcc/testsuite/g++.old-deja/g++.mike/p5840.C index 53b9510102f..34dd37df6c3 100644 --- a/gcc/testsuite/g++.old-deja/g++.mike/p5840.C +++ b/gcc/testsuite/g++.old-deja/g++.mike/p5840.C @@ -28,7 +28,7 @@ Derived a; /* Bar<Derived, &Signal::Name> dispatcher1; */ Bar<Derived, &Derived::Name> dispatcher2; -main() { +int main() { /* int i1 = dispatcher1.value(&a); */ int i2 = dispatcher2.value(&a); return /* i1 != 1 || */ i2 != 2; diff --git a/gcc/testsuite/g++.old-deja/g++.mike/p6058.C b/gcc/testsuite/g++.old-deja/g++.mike/p6058.C index aa78b7ff63d..91ebd22bac2 100644 --- a/gcc/testsuite/g++.old-deja/g++.mike/p6058.C +++ b/gcc/testsuite/g++.old-deja/g++.mike/p6058.C @@ -1,18 +1 @@ -// Build don't link: -// Special g++ Options: -fexceptions -pedantic-errors -// prms-id: 6058 - -void bar(struct s1 { } a) { (void)a; } // ERROR - - -struct s2*fooey() // ERROR - XFAIL *-*-* -{ - try { - static_cast<struct s3 { } *>(0); // ERROR - - const_cast<struct s4 { } *>((s4*)0); // ERROR - - reinterpret_cast<struct s5 { } *>((s3*)0); // ERROR - - dynamic_cast<struct s6 { } *>((s6*)0); // ERROR - - (struct s7 { } *)(int*)0xffedec; // ERROR - - } catch (struct s8 { } s) { // ERROR - - } - return 0; -} +struct s2*fooey() diff --git a/gcc/testsuite/g++.old-deja/g++.mike/p6311.C b/gcc/testsuite/g++.old-deja/g++.mike/p6311.C index 12d3cfc6169..b3b753c1a91 100644 --- a/gcc/testsuite/g++.old-deja/g++.mike/p6311.C +++ b/gcc/testsuite/g++.old-deja/g++.mike/p6311.C @@ -1,16 +1 @@ -// prms-id: 6311 - -struct Foo { - int member; -} a = { 42 }, *ptra = &a; - -int Foo::*pmd = &Foo::member; - -main() { - if (pmd == 0) - return 1; - if (a.*pmd != 42) - return 2; - if (ptra->*pmd != 42) - return 3; -} +int main() { diff --git a/gcc/testsuite/g++.old-deja/g++.mike/p658.C b/gcc/testsuite/g++.old-deja/g++.mike/p658.C index 614f7e933d1..14658f04956 100644 --- a/gcc/testsuite/g++.old-deja/g++.mike/p658.C +++ b/gcc/testsuite/g++.old-deja/g++.mike/p658.C @@ -35,7 +35,7 @@ private: char _c; }; -main() +int main() { Char r, s; diff --git a/gcc/testsuite/g++.old-deja/g++.mike/p6927.C b/gcc/testsuite/g++.old-deja/g++.mike/p6927.C index 827ef29b24d..b3b753c1a91 100644 --- a/gcc/testsuite/g++.old-deja/g++.mike/p6927.C +++ b/gcc/testsuite/g++.old-deja/g++.mike/p6927.C @@ -1,16 +1 @@ -// prms-id: 6927 - -class Object { -public: - Object(); - int Value; -}; - -Object::Object() : Value(-1) { } - -Object *pArr = new Object[2]; - -main() { - if (pArr[0].Value != -1 || pArr[1].Value != -1) - return 1; -} +int main() { diff --git a/gcc/testsuite/g++.old-deja/g++.mike/p701.C b/gcc/testsuite/g++.old-deja/g++.mike/p701.C index 4acf17038d4..29b55ae70ac 100644 --- a/gcc/testsuite/g++.old-deja/g++.mike/p701.C +++ b/gcc/testsuite/g++.old-deja/g++.mike/p701.C @@ -1,34 +1 @@ -// Build don't link: -// prms-id: 701 - -extern "C" -{ - int printf(const char *, ...); -}; - - -void Munge(int& x) -{ // ERROR - referenced below - x = 2; -} - - -class A -{ - public: - int i; - A(int x) : i(x) {} - void Safe() const; -}; - -void -A::Safe() const -{ - Munge(i); // ERROR - should not be able to modify a const object -} - -main() -{ - const A a(1); - a.Safe(); -} +int main() diff --git a/gcc/testsuite/g++.old-deja/g++.mike/p710.C b/gcc/testsuite/g++.old-deja/g++.mike/p710.C index c6ab3b1d902..62dffe9ff8e 100644 --- a/gcc/testsuite/g++.old-deja/g++.mike/p710.C +++ b/gcc/testsuite/g++.old-deja/g++.mike/p710.C @@ -35,7 +35,7 @@ class B void operator delete(void*){} }; -main() +int main() { B* p = new B; delete p; diff --git a/gcc/testsuite/g++.old-deja/g++.mike/p7325.C b/gcc/testsuite/g++.old-deja/g++.mike/p7325.C index 9cf4604daab..e6d76f5321e 100644 --- a/gcc/testsuite/g++.old-deja/g++.mike/p7325.C +++ b/gcc/testsuite/g++.old-deja/g++.mike/p7325.C @@ -48,7 +48,7 @@ void g () A::match_this = 0; } -main() { +int main() { f(); g(); return fail; diff --git a/gcc/testsuite/g++.old-deja/g++.mike/p755.C b/gcc/testsuite/g++.old-deja/g++.mike/p755.C index 9dbebff5485..256c985e271 100644 --- a/gcc/testsuite/g++.old-deja/g++.mike/p755.C +++ b/gcc/testsuite/g++.old-deja/g++.mike/p755.C @@ -10,7 +10,7 @@ void* operator new(size_t sz) throw (std::bad_alloc) { return p; } -main () { +int main () { int* i = new int; delete i; return 1; diff --git a/gcc/testsuite/g++.old-deja/g++.mike/p755a.C b/gcc/testsuite/g++.old-deja/g++.mike/p755a.C index 9f496c1e337..765014bc66d 100644 --- a/gcc/testsuite/g++.old-deja/g++.mike/p755a.C +++ b/gcc/testsuite/g++.old-deja/g++.mike/p755a.C @@ -1,14 +1 @@ -// It checks to see if you can define your own global delete operator. -// prms-id: 755 - -extern "C" void exit(int); - -void operator delete(void *p) throw() { - exit(0); -} - -main () { - int* i = new int; - delete i; - return 1; -} +int main () { diff --git a/gcc/testsuite/g++.old-deja/g++.mike/p7626.C b/gcc/testsuite/g++.old-deja/g++.mike/p7626.C index 61636d61fdb..b3b753c1a91 100644 --- a/gcc/testsuite/g++.old-deja/g++.mike/p7626.C +++ b/gcc/testsuite/g++.old-deja/g++.mike/p7626.C @@ -1,43 +1 @@ -// Build don't link: -// prms-id: 7626 - -int fail; - -typedef unsigned int UINT; - -class CObject{}; - -class CCmdTarget : public CObject { -}; - -typedef void (CCmdTarget::*AFX_PMSG)(void); - -struct AFX_MSGMAP_ENTRY { - AFX_PMSG pfn; -}; - -class CWnd : public CCmdTarget { -public: - void OnMyMsg() { fail = 1; } // If this one is called, something is wrong. - static AFX_MSGMAP_ENTRY _messageEntries[]; -}; - -typedef void (CWnd::*AFX_PMSGW)(void); - -class CDialog : public CWnd -{ -public: - void OnMyMsg() { } - static AFX_MSGMAP_ENTRY _messageEntries[]; -}; - -AFX_MSGMAP_ENTRY CDialog ::_messageEntries[] = { - { (AFX_PMSG)(AFX_PMSGW)(void (CWnd::*)())&CDialog::OnMyMsg }, - { (AFX_PMSG)0 } -}; - -main() { - CDialog d; - (d.*((CDialog::_messageEntries)[0]).pfn)(); // This should call CDialog::OnMyMsg - return fail; -} +int main() { diff --git a/gcc/testsuite/g++.old-deja/g++.mike/p7651.C b/gcc/testsuite/g++.old-deja/g++.mike/p7651.C index a295a8971af..b3b753c1a91 100644 --- a/gcc/testsuite/g++.old-deja/g++.mike/p7651.C +++ b/gcc/testsuite/g++.old-deja/g++.mike/p7651.C @@ -1,25 +1 @@ -// prms-id: 7651 - -int fail = 0; - -class Foo { -public: - Foo(double i) : data(i) { if (data != 1.0) fail = 1; } - ~Foo() { if (data != 1.0) fail = 1; } -private: - volatile double data; -}; - -int DingDong(double A) { - volatile Foo a(A); - - if ( A != 0.0 ) { - return 1; - } - return 0; -} - - -main() { - DingDong(1.0); -} +int main() { diff --git a/gcc/testsuite/g++.old-deja/g++.mike/p783.C b/gcc/testsuite/g++.old-deja/g++.mike/p783.C index ce22a7c14b5..a9ac84ed14b 100644 --- a/gcc/testsuite/g++.old-deja/g++.mike/p783.C +++ b/gcc/testsuite/g++.old-deja/g++.mike/p783.C @@ -1,15 +1 @@ -// prms-id: 783 - -extern "C" void printf (char *, ...); - -class C { -public: - C() { } - ~C() { } -}; - -main(int argc, char**argv) { - C c,d; - c = (argc&1) ? C() : d; - return 0; -} +int main(int argc, char**argv) { diff --git a/gcc/testsuite/g++.old-deja/g++.mike/p783a.C b/gcc/testsuite/g++.old-deja/g++.mike/p783a.C index 1883fc7ded2..a9ac84ed14b 100644 --- a/gcc/testsuite/g++.old-deja/g++.mike/p783a.C +++ b/gcc/testsuite/g++.old-deja/g++.mike/p783a.C @@ -1,26 +1 @@ -// Copying into an object directly is a lose according to tiemann. -// Deleting an object many times is a lose. -// prms-id: 783 - -extern "C" void printf (char *, ...); -extern "C" void exit (int); - -class C { - int i; -public: - C() { - i = 1; - } - ~C() { - if (i != 1) { - exit(1); - } - i = 0; - } -}; - -main(int argc, char**argv) { - C c; - c = C(); - return 0; -} +int main(int argc, char**argv) { diff --git a/gcc/testsuite/g++.old-deja/g++.mike/p783b.C b/gcc/testsuite/g++.old-deja/g++.mike/p783b.C index f4170bc21cc..a9ac84ed14b 100644 --- a/gcc/testsuite/g++.old-deja/g++.mike/p783b.C +++ b/gcc/testsuite/g++.old-deja/g++.mike/p783b.C @@ -1,37 +1 @@ -// This one check for objects being destroyed twice. The bug it is -// looking for is the extra dtor call on C() even though it is never -// built. -// prms-id: 783 - -extern "C" void printf (char *, ...); -extern "C" void exit (int); - -class C { - int i; -public: -// C() {printf ("C ctor at %x\n", this);} -// ~C() {printf ("C dtor at %x\n", this);} - C() { - i = 1; - } - ~C() { - if (i != 1) { - exit(1); - } - i = 0; - } -}; - -C g; - -C func() { - return g; -} - -main(int argc, char**argv) { - C c,d; -// printf ("\n"); - c = (argc != 1) ? C() : d; -// printf ("\n"); - return 0; -} +int main(int argc, char**argv) { diff --git a/gcc/testsuite/g++.old-deja/g++.mike/p784.C b/gcc/testsuite/g++.old-deja/g++.mike/p784.C index 6af675df593..ce6104977f1 100644 --- a/gcc/testsuite/g++.old-deja/g++.mike/p784.C +++ b/gcc/testsuite/g++.old-deja/g++.mike/p784.C @@ -616,7 +616,7 @@ class ostream : public ios void do_osfx(); public: ostream(); - ostream(streambuf* sb, ostream* tied=((void *)0) ); + ostream(streambuf* sb, ostream* tied=(__null) ); ~ostream(); int opfx() { if (!good()) return 0; if (_tie) _tie->flush(); return 1; } @@ -661,7 +661,7 @@ class istream : public ios size_t _gcount; public: istream(); - istream(streambuf* sb, ostream*tied=((void *)0) ); + istream(streambuf* sb, ostream*tied=(__null) ); ~istream(); streambuf* istreambuf() const { return _strbuf; } istream& get(char& c); @@ -2238,7 +2238,7 @@ class strstreambuf : public streambuf { public: strstreambuf(); strstreambuf(int initial); - strstreambuf(char *ptr, int size, char *pstart = ((void *)0) ); + strstreambuf(char *ptr, int size, char *pstart = (__null) ); ~strstreambuf(); int frozen() { return _frozen; } void freeze(int n=1) { _frozen = n != 0; } diff --git a/gcc/testsuite/g++.old-deja/g++.mike/p786.C b/gcc/testsuite/g++.old-deja/g++.mike/p786.C index 258c36511de..29b55ae70ac 100644 --- a/gcc/testsuite/g++.old-deja/g++.mike/p786.C +++ b/gcc/testsuite/g++.old-deja/g++.mike/p786.C @@ -1,35 +1 @@ -// prms-id: 786 - -extern "C" void printf (char *, ...); -extern "C" void exit(int); -class C - { - int a; -public: - C() {a = 1;} - }; - -void func(const C& a, C& b) -{ - printf ("in const func\n"); - exit(1); -} - -void func(C& a, C& b) -{ - printf ("in non-const func\n"); -} - -void testit(const C& a, C& b) -{ - func(a,b); -} - -main() -{ - C a; - C b; - - func(a,b); - return 0; -} +int main() diff --git a/gcc/testsuite/g++.old-deja/g++.mike/p7865.C b/gcc/testsuite/g++.old-deja/g++.mike/p7865.C index d9a611889b1..b3b753c1a91 100644 --- a/gcc/testsuite/g++.old-deja/g++.mike/p7865.C +++ b/gcc/testsuite/g++.old-deja/g++.mike/p7865.C @@ -1,28 +1 @@ -// prms-id: 7865 - -int count; - -struct A { - A() { ++count; } - ~A() { --count; } -}; - -int foo() { return 1; } - -int bar() -{ - A a; - for (;;) { - A b; - if (foo()) - return 0; - if (foo()) - return 0; - } - return 0; -} - -main() { - bar(); - return count; -} +int main() { diff --git a/gcc/testsuite/g++.old-deja/g++.mike/p7868.C b/gcc/testsuite/g++.old-deja/g++.mike/p7868.C index d8ce95d3c66..cde795445b9 100644 --- a/gcc/testsuite/g++.old-deja/g++.mike/p7868.C +++ b/gcc/testsuite/g++.old-deja/g++.mike/p7868.C @@ -1,21 +1,2 @@ -// Build don't link: -// prms-id: 7868 - -struct DIAGTYP { -}; -struct DIAGTYP1 { - struct DIAGTYP; - void bar() { new struct DIAGTYP; } // ERROR - undefined - void foo() { new struct DIAGTYP1; } -}; - -int main () { - struct DIAGTYP; - struct DIAGTYP *lerror_desc; - lerror_desc= new struct DIAGTYP; // ERROR - undefined -} - -void foo () { - struct DIAGTYP *lerror_desc; - lerror_desc= new struct DIAGTYP; -} + struct DIAGTYP; // ERROR - forward declaration + struct DIAGTYP; // ERROR - forward declaration diff --git a/gcc/testsuite/g++.old-deja/g++.mike/p789.C b/gcc/testsuite/g++.old-deja/g++.mike/p789.C index 09815989d5b..fca7aa3a92f 100644 --- a/gcc/testsuite/g++.old-deja/g++.mike/p789.C +++ b/gcc/testsuite/g++.old-deja/g++.mike/p789.C @@ -1,28 +1 @@ -// prms-id: 789 - -extern "C" void printf (char *, ...); -struct foo -{ - static int count; - virtual void print (int i, int j) { printf ("foo[%d][%d] = %d\n", i, j, x); } - int x; - foo () { x = count++; } -}; -int foo::count; -struct bar : virtual public foo -{ - virtual void print (int i, int j) { printf ("bar[%d][%d] = %d\n", i, j, x); } -}; - -// bar array[3][3]; -foo array[3][3]; - -main () -{ - for (int i = 0; i < 3; i++) - for (int j = 0; j < 3; j++) { -// printf("&a[%d][%d] = %x\n", i, j, (void *)&array[i][j]); - array[i][j].print (i, j); - } - return 0; -} +int main () diff --git a/gcc/testsuite/g++.old-deja/g++.mike/p789a.C b/gcc/testsuite/g++.old-deja/g++.mike/p789a.C index 9086ff54cfe..fca7aa3a92f 100644 --- a/gcc/testsuite/g++.old-deja/g++.mike/p789a.C +++ b/gcc/testsuite/g++.old-deja/g++.mike/p789a.C @@ -1,43 +1 @@ -// global and local multidimensional array objects are not getting -// constructors called on any dimension, other than the first. Also, -// the destructors are not being called. Seems odd, they probably -// used to work. :-( -// prms-id: 789 - -extern "C" void printf (char *, ...); -struct foo -{ - static int count; - void print (int i, int j) { printf ("foo[%d][%d] = %d\n", i, j, x); } - int x; - foo () { - x = count++; - printf("this %d = %x\n", x, (void *)this); - } - virtual ~foo () { - printf("this %d = %x\n", x, (void *)this); - --count; - } -}; -int foo::count; - - -main () -{ - { - foo array[3][3]; - for (int i = 0; i < 3; i++) - { - for (int j = 0; j < 3; j++) - { - printf("&a[%d][%d] = %x\n", i, j, (void *)&array[i][j]); - } - } - // The count should be nine, if not, fail the test. - if (foo::count != 9) - return 1; - } - if (foo::count != 0) - return 1; - return 0; -} +int main () diff --git a/gcc/testsuite/g++.old-deja/g++.mike/p8039.C b/gcc/testsuite/g++.old-deja/g++.mike/p8039.C index 73defeccd97..29b55ae70ac 100644 --- a/gcc/testsuite/g++.old-deja/g++.mike/p8039.C +++ b/gcc/testsuite/g++.old-deja/g++.mike/p8039.C @@ -1,14 +1 @@ -// prms-id: 8039 - -class C { -public: - int func (); -}; - -extern void bar(int*); - -main() -{ - int (C::*mfp)() = &C::func; - bar((int*)mfp); // ERROR - no clear semantics -} +int main() diff --git a/gcc/testsuite/g++.old-deja/g++.mike/p807.C b/gcc/testsuite/g++.old-deja/g++.mike/p807.C index 59df08e5149..29b55ae70ac 100644 --- a/gcc/testsuite/g++.old-deja/g++.mike/p807.C +++ b/gcc/testsuite/g++.old-deja/g++.mike/p807.C @@ -1,34 +1 @@ -// prms-id: 807 - -extern "C" int printf(const char*, ...); - -class B; - -class AX -{ - protected: - int x; - - public: - operator B(); -}; - - -class B -{ - private: - int x; - public: - B(const AX&); -}; - - -int foo(B& b); // ERROR - referenced below - - -main() -{ - AX a; - foo(a); // ERROR - Ambiguous B(a) or a.operator B() // See ARM 12.3.2 - -} +int main() diff --git a/gcc/testsuite/g++.old-deja/g++.mike/p8155.C b/gcc/testsuite/g++.old-deja/g++.mike/p8155.C index f62291062f1..bf854151126 100644 --- a/gcc/testsuite/g++.old-deja/g++.mike/p8155.C +++ b/gcc/testsuite/g++.old-deja/g++.mike/p8155.C @@ -1,147 +1 @@ -// prms-id: 8155 - -int fail = 1; - -class CMainWindow; -class CFrameWnd; -class CWnd; -class CCmdTarget; - -typedef void (CCmdTarget::*AFX_PMSG)( void); -typedef void (CWnd::*AFX_PMSGW)( void); - -struct AFX_MSGMAP_ENTRY { - unsigned int nMessage; - AFX_PMSG pfn; -}; - -struct AFX_MSGMAP { - const AFX_MSGMAP* pBaseMap; - const AFX_MSGMAP_ENTRY* lpEntries; -}; - -class CCmdTarget { -public: - CCmdTarget(); -private: - static AFX_MSGMAP_ENTRY _messageEntries[]; -protected: - static const AFX_MSGMAP messageMap; - virtual const AFX_MSGMAP* GetMessageMap() const; -}; - -const AFX_MSGMAP CCmdTarget::messageMap = { - 0, &CCmdTarget::_messageEntries[0] -}; - -const AFX_MSGMAP* CCmdTarget::GetMessageMap() const { - return &CCmdTarget::messageMap; -} - -AFX_MSGMAP_ENTRY CCmdTarget::_messageEntries[] = -{ - { 0, 0 } -}; - -CCmdTarget :: CCmdTarget() { } - -class CWnd : public CCmdTarget { -public: - CWnd(); - -protected: - void OnPaint(); -private: - static AFX_MSGMAP_ENTRY _messageEntries[]; -protected: - static const AFX_MSGMAP messageMap; - virtual const AFX_MSGMAP* GetMessageMap() const; -}; - -CWnd :: CWnd() { -} - -void CWnd :: OnPaint() { -} - -const AFX_MSGMAP* CWnd ::GetMessageMap() const { - return & CWnd ::messageMap; -} -const AFX_MSGMAP CWnd ::messageMap = { - & CCmdTarget ::messageMap, & CWnd ::_messageEntries[0] - }; -AFX_MSGMAP_ENTRY CWnd ::_messageEntries[] = { - {0, (AFX_PMSG)0 } }; - -class CFrameWnd : public CWnd { -public: - CFrameWnd(); -protected: -private: - static AFX_MSGMAP_ENTRY _messageEntries[]; -protected: - static const AFX_MSGMAP messageMap; - virtual const AFX_MSGMAP* GetMessageMap() const; -}; - -CFrameWnd :: CFrameWnd() { } - -const AFX_MSGMAP* CFrameWnd ::GetMessageMap() const { - return & CFrameWnd ::messageMap; -} -const AFX_MSGMAP CFrameWnd ::messageMap = { - & CWnd ::messageMap, & CFrameWnd ::_messageEntries[0] - }; -AFX_MSGMAP_ENTRY CFrameWnd ::_messageEntries[] = { - {0, (AFX_PMSG)0 } }; - -class CMainWindow : public CFrameWnd { -public: - CMainWindow(); - void OnPaint(); - void callProc(); -private: - static AFX_MSGMAP_ENTRY _messageEntries[]; -protected: - static const AFX_MSGMAP messageMap; - virtual const AFX_MSGMAP* GetMessageMap() const; -}; - -CMainWindow :: CMainWindow() -{ -} -void CMainWindow :: OnPaint() -{ - fail = 0; -} - -void CMainWindow :: callProc() -{ - const AFX_MSGMAP* pMessageMap; - const AFX_MSGMAP_ENTRY *lpEntry; - - pMessageMap = GetMessageMap(); - lpEntry = pMessageMap->lpEntries; - - if( lpEntry->nMessage == 100) { - (this->*lpEntry->pfn)(); - } -} - -const AFX_MSGMAP* CMainWindow ::GetMessageMap() const { - return & CMainWindow ::messageMap; -} -const AFX_MSGMAP CMainWindow ::messageMap = { - & CFrameWnd ::messageMap, & CMainWindow ::_messageEntries[0] - }; -AFX_MSGMAP_ENTRY CMainWindow ::_messageEntries[] = { - { 100, (AFX_PMSG)(AFX_PMSGW)(void (CWnd::*)(void))&CMainWindow::OnPaint }, - {0, (AFX_PMSG)0 } -}; - -main( int argc, char **argv) { - CMainWindow myWindow; - - myWindow.callProc(); - return fail; -} +int main( int argc, char **argv) { diff --git a/gcc/testsuite/g++.old-deja/g++.mike/p8460.C b/gcc/testsuite/g++.old-deja/g++.mike/p8460.C index 542921c5738..29b55ae70ac 100644 --- a/gcc/testsuite/g++.old-deja/g++.mike/p8460.C +++ b/gcc/testsuite/g++.old-deja/g++.mike/p8460.C @@ -1,17 +1 @@ -// Build don't link: -// prms-id: 8460 - -class A { -public: - A(); - A(int) { } - A(const A&) { } -private: -}; - -main() -{ - A a; - - a.A(1); // ERROR - cannot find name this way -} +int main() diff --git a/gcc/testsuite/g++.old-deja/g++.mike/p8483.C b/gcc/testsuite/g++.old-deja/g++.mike/p8483.C index b04901844fa..b3b753c1a91 100644 --- a/gcc/testsuite/g++.old-deja/g++.mike/p8483.C +++ b/gcc/testsuite/g++.old-deja/g++.mike/p8483.C @@ -1,35 +1 @@ -// prms-id: 8483 - -int count; - -class A { -public: - A() { ++count; } - ~A() { } -}; - -class B { -private: - A b[2]; -}; - -class C { -public: -private: - A c[2][2]; -}; - -class D { -public: -private: - A d[2][2][2]; -}; - -main() { - { A a; } - { B b; } - { C c; } - { D d; } - if (count != 15) - return 1; -} +int main() { diff --git a/gcc/testsuite/g++.old-deja/g++.mike/p8785.C b/gcc/testsuite/g++.old-deja/g++.mike/p8785.C index 9c977fdcd30..2ab5fcb524a 100644 --- a/gcc/testsuite/g++.old-deja/g++.mike/p8785.C +++ b/gcc/testsuite/g++.old-deja/g++.mike/p8785.C @@ -1,25 +1,2 @@ -// Build don't link: -// prms-id: 8785 - -class Outer { -private: - int x; -public: - struct Inner { - int y; - void f( Outer * p, int i) { - p->x = i; // ERROR - - }; - void f( Outer & p) { - p.x = y; // ERROR - - }; - }; -}; - -main() { - Outer::Inner A; - Outer Thing; - - A.f(Thing); - A.f(&Thing,2); -} + int x; // ERROR - private +int main() { diff --git a/gcc/testsuite/g++.old-deja/g++.mike/p8804.C b/gcc/testsuite/g++.old-deja/g++.mike/p8804.C index e46a4c677ec..b3b753c1a91 100644 --- a/gcc/testsuite/g++.old-deja/g++.mike/p8804.C +++ b/gcc/testsuite/g++.old-deja/g++.mike/p8804.C @@ -1,18 +1 @@ -// prms-id: 8804 - -extern "C" int printf (const char *, ...); - -struct Fails { - int i; - union { - union { - int c; - }; - }; -}; - -Fails d; - -main() { - return &d.i == &d.c; -} +int main() { diff --git a/gcc/testsuite/g++.old-deja/g++.mike/pmf1.C b/gcc/testsuite/g++.old-deja/g++.mike/pmf1.C index 5b2dde87543..29b55ae70ac 100644 --- a/gcc/testsuite/g++.old-deja/g++.mike/pmf1.C +++ b/gcc/testsuite/g++.old-deja/g++.mike/pmf1.C @@ -1,90 +1 @@ -// extern "C" printf(const char *, ...); - -class X -{ -public: - int a; - int f(int); -}; - -class Y -{ -public: - int b; - int c; - int g(int); -}; - -class MD : public X, public Y -{ -public: - int c; - int hf(int); -}; - -int MD::* pmi0 = &MD::a; -int MD::* pmi1 = &MD::b; -int MD::* pmi2 = &MD::c; - -int (MD::* pmf0)(int) = &MD::f; -int (MD::* pmf1)(int) = &MD::g; -int (MD::* pmf2)(int) = &MD::hf; - -main() -{ - MD obj; - int fail = 0; - - obj.a = 1; - obj.b = 2; - obj.c = 3; - - obj.*pmi0 = 7; - obj.*pmi1 = 8; - obj.*pmi2 = 9; - - fail += (obj.*pmf0)(7); - fail += (obj.*pmf1)(8); - fail += (obj.*pmf2)(9); - -#if 0 - if (fail != 0) - printf ("failed %d tests\n", fail); - else - printf ("passed\n"); - - printf ("sizeof(X) = %d, sizeof(Y) = %d, sizeof(MD) = %d\n", - sizeof(X), sizeof(Y), sizeof(MD)); -#endif - return fail; -} - -int X::f(int v) -{ - if (v != a) - { -// printf ("failed in X::f, a = %d\n", a); - return 1; - } - return 0; -} - -int Y::g(int v) -{ - if (v != b) - { -// printf ("failed in Y::g, b = %d\n", b); - return 1; - } - return 0; -} - -int MD::hf(int v) -{ - if (v != c) - { -// printf ("failed in MD::hf, c = %d\n", c); - return 1; - } - return 0; -} +int main() diff --git a/gcc/testsuite/g++.old-deja/g++.mike/pmf2.C b/gcc/testsuite/g++.old-deja/g++.mike/pmf2.C index 2f1bec51e95..b3b753c1a91 100644 --- a/gcc/testsuite/g++.old-deja/g++.mike/pmf2.C +++ b/gcc/testsuite/g++.old-deja/g++.mike/pmf2.C @@ -1,54 +1 @@ -extern "C" int printf(const char *, ...); - -class A_table { - int c; -public: - A_table() { c = 3;} - virtual void func2(int &item) { printf("func2(%d,) c=%d\n",item,c);} -}; - -class B_table : private A_table { - typedef void (B_table::* B_ti_fn) (int &item); -public: - B_table() { j = 0x4321;} - virtual void call_fn_fn1(int &item, void *pfn1); - void func1(int &item) { printf("func1(%d)\n",item);} - virtual void func2(int &item) { printf("func2(%d) j=%d\n",item,j);} - int j; -}; - -class foo : public A_table { -public: - int i; - virtual ~foo(); - virtual void func2(int &item) { printf("func2(%d) i=%d\n",item,i);} -}; -foo::~foo() { i = 0;} - -class bar :public foo,public B_table { -public: - int w; - virtual ~bar(); - virtual void func2(int &item) { printf("func2(%d) w=%d\n",item,w);} -}; -bar::~bar() { w = 0;} - -void B_table::call_fn_fn1(int &item, void *pfn1) { - (this->*(*(B_ti_fn*)pfn1))(item); -} - -B_table b; -bar jar; - -main() { - printf("ptr to B_table=%x, ptr to A_table=%x\n",&b,(A_table*)&b); - B_table::B_ti_fn z = &B_table::func1; - int j = 1; - jar.call_fn_fn1(j,(void *)&z); - j++; - z = &B_table::func2; - b.call_fn_fn1(j,(void *)&z); - j++; - jar.call_fn_fn1(j,(void *)&z); - return 0; -} +int main() { diff --git a/gcc/testsuite/g++.old-deja/g++.mike/pmf3.C b/gcc/testsuite/g++.old-deja/g++.mike/pmf3.C index 24753eb1f9a..76fa1ef28e1 100644 --- a/gcc/testsuite/g++.old-deja/g++.mike/pmf3.C +++ b/gcc/testsuite/g++.old-deja/g++.mike/pmf3.C @@ -1,19 +1,3 @@ -struct Fooey { - void f(char* pX); - void f(int in); - void f(float fx); - void h(double dx); -}; - -void Fooey::f(char*) { } -void Fooey::f(int) { } -void Fooey::f(float) { } -void Fooey::h(double zahl) { } - -int main() { - Fooey Blah; - void (Fooey::*pointer)(double); - pointer = &Fooey::f; // ERROR - don't call Fooey::h - (Blah.*pointer)(42.5); - return 0; -} +void Fooey::f(char*) { } // ERROR - candidate +void Fooey::f(int) { } // ERROR - candidate +void Fooey::f(float) { } // ERROR - candidate diff --git a/gcc/testsuite/g++.old-deja/g++.mike/pmf6.C b/gcc/testsuite/g++.old-deja/g++.mike/pmf6.C index c5327070617..0833700f387 100644 --- a/gcc/testsuite/g++.old-deja/g++.mike/pmf6.C +++ b/gcc/testsuite/g++.old-deja/g++.mike/pmf6.C @@ -1,12 +1 @@ -// Special g++ Options: - -class S { -public: - void (S::*pmf)(); - void foo() { - pmf(); // WARNING - - } - static foo1(S* sp) { - (sp->pmf)(); // ERROR - - } -}; + static void foo1(S* sp) { diff --git a/gcc/testsuite/g++.old-deja/g++.mike/rtti2.C b/gcc/testsuite/g++.old-deja/g++.mike/rtti2.C index bf08ede33fd..b3b753c1a91 100644 --- a/gcc/testsuite/g++.old-deja/g++.mike/rtti2.C +++ b/gcc/testsuite/g++.old-deja/g++.mike/rtti2.C @@ -1,5 +1 @@ -#include <typeinfo> - -main() { - typeid(bool); -} +int main() { diff --git a/gcc/testsuite/g++.old-deja/g++.mike/scast1.C b/gcc/testsuite/g++.old-deja/g++.mike/scast1.C index dbc5efc4e40..b3b753c1a91 100644 --- a/gcc/testsuite/g++.old-deja/g++.mike/scast1.C +++ b/gcc/testsuite/g++.old-deja/g++.mike/scast1.C @@ -1,7 +1 @@ -class A {}; -class C {}; - -main() { - A* a = 0; - C* c = static_cast<C*>(a); // ERROR - bad static cast -} +int main() { diff --git a/gcc/testsuite/g++.old-deja/g++.mike/temp.C b/gcc/testsuite/g++.old-deja/g++.mike/temp.C index 8ca31f345b3..b3b753c1a91 100644 --- a/gcc/testsuite/g++.old-deja/g++.mike/temp.C +++ b/gcc/testsuite/g++.old-deja/g++.mike/temp.C @@ -1,31 +1 @@ -extern "C" int printf(const char *, ...); -extern "C" const char *getenv(const char *); - -class T { - int i; -public: - T() { - i = 1; - printf("T() at %x\n", this); - } - T(const T& o) { - i = o.i; - printf("T(const T&) at %x <-- %x\n", this, &o); - } - T operator +(const T& o) { - T r; - r.i = this->i + o.i; - return r; - } - operator int () { - return i; - } - ~T() { printf("~T() at %x\n", this); } -} s, b; - -int foo() { return getenv("TEST") == 0; } - -main() { - int i = foo() ? s+b : s; - return i != 2; -} +int main() { diff --git a/gcc/testsuite/g++.old-deja/g++.mike/virt4.C b/gcc/testsuite/g++.old-deja/g++.mike/virt4.C index 989701833b6..b3f1a9e8871 100644 --- a/gcc/testsuite/g++.old-deja/g++.mike/virt4.C +++ b/gcc/testsuite/g++.old-deja/g++.mike/virt4.C @@ -1,25 +1,2 @@ -void Foo () {} +// Special g++ Options: -class B { -public: - virtual void foo() = 0; -}; - -class D: virtual public B { -public: - void foo() { Foo(); } -}; - -class D1: public D {}; - -class D2: public D {}; - -class D1_2: public D1, public D2 { -public: - void foo() { D1::foo(); D2::foo(); } -}; - -main() { - D1_2 h; - h.foo(); -} diff --git a/gcc/testsuite/g++.old-deja/g++.mike/virt5.C b/gcc/testsuite/g++.old-deja/g++.mike/virt5.C index a9040c95879..b3b753c1a91 100644 --- a/gcc/testsuite/g++.old-deja/g++.mike/virt5.C +++ b/gcc/testsuite/g++.old-deja/g++.mike/virt5.C @@ -1,53 +1 @@ -// Ensure that virtual base upcast and downcasting works on this -// conversions during virtual function dispatch at ctor/dtor time -// when dynamic vtable fixups for deltas are needed. - -int fail = 0; - -struct BASE1 { - virtual ~BASE1 () { } -}; - -class MID; - -class BASE2 { -public: - virtual MID *VFN (){ return 0; } -}; - -class MIBASE : public BASE1, public BASE2 { }; - -class VBB : public MIBASE { -public: - virtual long get_STATE () const = 0; - void print_STATE() { if (get_STATE () != 87654321) fail = 1; } -}; - -class VBD : public virtual VBB { - long STATE; -public: - long get_STATE() const { return STATE; } - VBD() { STATE = 87654321; } - ~VBD() { STATE = 87654321; } -}; - -class MID : public virtual VBD { -public: - MID () { print_STATE(); } - ~MID () { print_STATE(); } - virtual MID *VFN() { return this; } -}; - -class LAST : public MID { -public: - LAST () { print_STATE(); } - ~LAST () { print_STATE(); } -}; - -main() { - MIBASE *o = new LAST; - MID *p = o->VFN(); - p->print_STATE(); - delete o; - return fail; -} +int main() { diff --git a/gcc/testsuite/g++.old-deja/g++.mike/warn2.C b/gcc/testsuite/g++.old-deja/g++.mike/warn2.C index a7ce899a31e..4f388e32cbc 100644 --- a/gcc/testsuite/g++.old-deja/g++.mike/warn2.C +++ b/gcc/testsuite/g++.old-deja/g++.mike/warn2.C @@ -1,24 +1,2 @@ -// Build don't link: -// Special g++ Options: -Wall -enum Boolean { - Ok = 0, - NotOk = 1, -}; - -enum OpResult { - Succeeded = 0, - TempFail = 1, - PermFail = 2, -}; - -OpResult fn1() { - return TempFail; -} - -extern void foo(); -main () { - if (fn1() == Ok) { // WARNING - - foo(); - } -} +int diff --git a/gcc/testsuite/g++.old-deja/g++.niklas/t141.C b/gcc/testsuite/g++.old-deja/g++.niklas/t141.C index dda60f549eb..6c81695aebe 100644 --- a/gcc/testsuite/g++.old-deja/g++.niklas/t141.C +++ b/gcc/testsuite/g++.old-deja/g++.niklas/t141.C @@ -1,6 +1 @@ -// Build don't link: -// Special g++ Options: -Wshadow -// GROUPS passed niklas scoping ARM -class X { X (int); }; // WARNING - private -void X (int);// ERROR - .*hides constructor.* -void f () { X (1); } +class X { X (int); }; diff --git a/gcc/testsuite/g++.old-deja/g++.ns/extern1.C b/gcc/testsuite/g++.old-deja/g++.ns/extern1.C index f4ab5ef9e74..906b97b8f06 100644 --- a/gcc/testsuite/g++.old-deja/g++.ns/extern1.C +++ b/gcc/testsuite/g++.old-deja/g++.ns/extern1.C @@ -7,7 +7,7 @@ namespace { void foo() { - extern int xx; // causes linker error - XFAIL *-*-* + extern int xx; xx = 0; } int xx = 1; diff --git a/gcc/testsuite/g++.old-deja/g++.ns/lookup3.C b/gcc/testsuite/g++.old-deja/g++.ns/lookup3.C index cd1aaaef517..3ace233c1b9 100644 --- a/gcc/testsuite/g++.old-deja/g++.ns/lookup3.C +++ b/gcc/testsuite/g++.old-deja/g++.ns/lookup3.C @@ -8,7 +8,7 @@ int A::f() return i; } -main() +int main() { return A::f(); } diff --git a/gcc/testsuite/g++.old-deja/g++.ns/ns1.C b/gcc/testsuite/g++.old-deja/g++.ns/ns1.C index 7c4fd920e5d..f835716d2c3 100644 --- a/gcc/testsuite/g++.old-deja/g++.ns/ns1.C +++ b/gcc/testsuite/g++.old-deja/g++.ns/ns1.C @@ -10,7 +10,7 @@ namespace foo{ } } -main(int,char**) +int main(int,char**) { return foo::eine_funktion(1); } diff --git a/gcc/testsuite/g++.old-deja/g++.ns/ns12.C b/gcc/testsuite/g++.old-deja/g++.ns/ns12.C index 33d50b1d26c..40f5b7cfe25 100644 --- a/gcc/testsuite/g++.old-deja/g++.ns/ns12.C +++ b/gcc/testsuite/g++.old-deja/g++.ns/ns12.C @@ -16,7 +16,7 @@ int barney() return 1; } -main() +int main() { return fred::barney(); } diff --git a/gcc/testsuite/g++.old-deja/g++.ns/ns13.C b/gcc/testsuite/g++.old-deja/g++.ns/ns13.C index 0272055d52c..0b8c38a1cbb 100644 --- a/gcc/testsuite/g++.old-deja/g++.ns/ns13.C +++ b/gcc/testsuite/g++.old-deja/g++.ns/ns13.C @@ -7,7 +7,7 @@ namespace std{ void std::g() {} -main() +int main() { return std::i-5; } diff --git a/gcc/testsuite/g++.old-deja/g++.ns/ns2.C b/gcc/testsuite/g++.old-deja/g++.ns/ns2.C index dcef2039340..e0d1bdade04 100644 --- a/gcc/testsuite/g++.old-deja/g++.ns/ns2.C +++ b/gcc/testsuite/g++.old-deja/g++.ns/ns2.C @@ -19,7 +19,7 @@ void andere_funktion() var=4; } -main(int,char**) +int main(int,char**) { andere_funktion(); return 0; diff --git a/gcc/testsuite/g++.old-deja/g++.ns/ns6.C b/gcc/testsuite/g++.old-deja/g++.ns/ns6.C index 0617b79a2ef..ba2508c6ded 100644 --- a/gcc/testsuite/g++.old-deja/g++.ns/ns6.C +++ b/gcc/testsuite/g++.old-deja/g++.ns/ns6.C @@ -7,7 +7,7 @@ namespace A{ } } -main() +int main() { return A::i-A::B::i; } diff --git a/gcc/testsuite/g++.old-deja/g++.ns/overload1.C b/gcc/testsuite/g++.old-deja/g++.ns/overload1.C index 6f6f3d47f51..55d66a1de09 100644 --- a/gcc/testsuite/g++.old-deja/g++.ns/overload1.C +++ b/gcc/testsuite/g++.old-deja/g++.ns/overload1.C @@ -21,7 +21,7 @@ int f(int,int) using namespace A; using namespace B; -main() +int main() { if(f() != 1) return 1; diff --git a/gcc/testsuite/g++.old-deja/g++.ns/overload4.C b/gcc/testsuite/g++.old-deja/g++.ns/overload4.C index 24d0ced19a5..ad961576419 100644 --- a/gcc/testsuite/g++.old-deja/g++.ns/overload4.C +++ b/gcc/testsuite/g++.old-deja/g++.ns/overload4.C @@ -1,6 +1,6 @@ // Build don't link: namespace A{ - void f(); // ERROR - .* + void f(); } using A::f; diff --git a/gcc/testsuite/g++.old-deja/g++.ns/overload5.C b/gcc/testsuite/g++.old-deja/g++.ns/overload5.C index 210f3b0eb59..24a0a6df4da 100644 --- a/gcc/testsuite/g++.old-deja/g++.ns/overload5.C +++ b/gcc/testsuite/g++.old-deja/g++.ns/overload5.C @@ -1,6 +1,6 @@ // Build don't link: namespace A{ - void f(){} // ERROR - previous declaration + void f(){} } using A::f; diff --git a/gcc/testsuite/g++.old-deja/g++.ns/template6.C b/gcc/testsuite/g++.old-deja/g++.ns/template6.C index 66fe956d6b0..324b4d22a59 100644 --- a/gcc/testsuite/g++.old-deja/g++.ns/template6.C +++ b/gcc/testsuite/g++.old-deja/g++.ns/template6.C @@ -13,7 +13,7 @@ namespace A { }; template <> - const unsigned B<int,int>::count = 2; + const unsigned B<int,int>::count = 2; // ERROR - duplicate init } }; diff --git a/gcc/testsuite/g++.old-deja/g++.other/ambig1.C b/gcc/testsuite/g++.old-deja/g++.other/ambig1.C index 04e4afa1205..d6574a2b79c 100644 --- a/gcc/testsuite/g++.old-deja/g++.other/ambig1.C +++ b/gcc/testsuite/g++.old-deja/g++.other/ambig1.C @@ -1,15 +1,15 @@ // Build don't link: struct A { - int operator ++(); - void operator ()(); - void operator delete(void*); + int operator ++(); // ERROR - candidates + void operator ()(); // ERROR - candidates + void operator delete(void*); // ERROR - candidates }; struct B { - int operator ++(int); - void operator ()(); - void operator delete(void*); + int operator ++(int); // ERROR - candidates + void operator ()(); // ERROR - candidates + void operator delete(void*); // ERROR - candidates void f(); }; diff --git a/gcc/testsuite/g++.old-deja/g++.other/badopt1.C b/gcc/testsuite/g++.old-deja/g++.other/badopt1.C index ea8b6844b68..096770e77ad 100644 --- a/gcc/testsuite/g++.old-deja/g++.other/badopt1.C +++ b/gcc/testsuite/g++.old-deja/g++.other/badopt1.C @@ -1,8 +1,6 @@ // Based on a testcase by Bryan Weston <bryanw@bluemoon.sps.mot.com> // egcs 1.1 fails to increment count -// execution test - XFAIL *-*-* - #include <cstdlib> struct Base { Base() {} }; // removing the constructor fixes the problem diff --git a/gcc/testsuite/g++.old-deja/g++.other/cleanup1.C b/gcc/testsuite/g++.old-deja/g++.other/cleanup1.C index ce373601ded..fd4dc6e4db0 100644 --- a/gcc/testsuite/g++.old-deja/g++.other/cleanup1.C +++ b/gcc/testsuite/g++.old-deja/g++.other/cleanup1.C @@ -12,7 +12,7 @@ int f (const A& a) return 1; } -main () +int main () { if (f (A()) && d == 0) return 0; diff --git a/gcc/testsuite/g++.old-deja/g++.other/decl2.C b/gcc/testsuite/g++.old-deja/g++.other/decl2.C index 35046504fb4..1da75406d9f 100644 --- a/gcc/testsuite/g++.old-deja/g++.other/decl2.C +++ b/gcc/testsuite/g++.old-deja/g++.other/decl2.C @@ -1,8 +1,6 @@ // Build don't link: // Based on a test-case by Maciej Radziejewski <maciejr@iws.uni-stuttgart.de> -// crash test - XFAIL *-*-* - int i(0)(1); // ERROR - multiple initialization int j(2) = 3; // ERROR - multiple initialization int k(4)(5)(6); // ERROR - multiple initialization diff --git a/gcc/testsuite/g++.old-deja/g++.other/delete2.C b/gcc/testsuite/g++.old-deja/g++.other/delete2.C index 09362f6895f..d90def03a3f 100644 --- a/gcc/testsuite/g++.old-deja/g++.other/delete2.C +++ b/gcc/testsuite/g++.old-deja/g++.other/delete2.C @@ -5,8 +5,8 @@ struct foo { }; void bar(foo a) { - delete a; // should be accepted - XFAIL *-*-* - delete[] a; // should be accepted - XFAIL *-*-* + delete a; // should be accepted + delete[] a; // should be accepted char b[1]; delete b; // ERROR - expecting pointer type delete[] b; // ERROR - expecting pointer type diff --git a/gcc/testsuite/g++.old-deja/g++.other/friend1.C b/gcc/testsuite/g++.old-deja/g++.other/friend1.C index e00f5e6b259..76fcebe1fae 100644 --- a/gcc/testsuite/g++.old-deja/g++.other/friend1.C +++ b/gcc/testsuite/g++.old-deja/g++.other/friend1.C @@ -9,21 +9,77 @@ // From: Alexandre Oliva <oliva@dcc.unicamp.br> // Date: 06 Mar 1998 01:43:18 -0300 +template <int*> +class X {}; + +template <typename T> +void g(); + +struct S; + +template <typename T> +struct R; class B { protected: - int i; - static int j; + int i; // ERROR - in this context + static int j; }; class D : public B { - friend void f(); + friend void f(); + template <typename T> + friend void g(); + friend struct S; + template <typename T> + friend struct R; +}; + +struct S { + void h(); + X<&B::j> x; +}; + +template <typename T> +struct R { + void h(); + X<&B::j> x; }; void f() { ((B*)0)->i = 3; // ERROR - protected ((D*)0)->i = 4; - B::j = 5; // gets bogus error - XFAIL *-*-* + B::j = 5; D::j = 6; } + +template <typename T> +void g() +{ + ((B*)0)->i = 3; // ERROR - protected + ((D*)0)->i = 4; + B::j = 5; + D::j = 6; +} + +template void g<int>(); + +void S::h() +{ + ((B*)0)->i = 3; // ERROR - protected + ((D*)0)->i = 4; + B::j = 5; + D::j = 6; +} + +template <typename T> +void R<T>::h() +{ + ((B*)0)->i = 3; // ERROR - protected + ((D*)0)->i = 4; + B::j = 5; + D::j = 6; +} + +template struct R<double>; diff --git a/gcc/testsuite/g++.old-deja/g++.other/friend4.C b/gcc/testsuite/g++.old-deja/g++.other/friend4.C index 468340f7b64..07969cd5487 100644 --- a/gcc/testsuite/g++.old-deja/g++.other/friend4.C +++ b/gcc/testsuite/g++.old-deja/g++.other/friend4.C @@ -10,7 +10,7 @@ template <class A, class B> void foo(); template <class C> class bar { - int i; + int i; // ERROR - private template <class B> friend void foo<C,B>(); // ERROR - bogus declaration }; template <class A, class B> void foo() { diff --git a/gcc/testsuite/g++.old-deja/g++.other/init7.C b/gcc/testsuite/g++.old-deja/g++.other/init7.C index 9a3d5d03dfa..3b17da029e8 100644 --- a/gcc/testsuite/g++.old-deja/g++.other/init7.C +++ b/gcc/testsuite/g++.old-deja/g++.other/init7.C @@ -4,8 +4,6 @@ // The initialization of a static local variable must be retried if a // previous try finished by throwing an exception [stmt.dcl]/4 -// execution test - XFAIL *-*-* - struct foo { foo() { throw true; } }; diff --git a/gcc/testsuite/g++.old-deja/g++.other/overload1.C b/gcc/testsuite/g++.old-deja/g++.other/overload1.C index dde6d4fafc7..59191d501e2 100644 --- a/gcc/testsuite/g++.old-deja/g++.other/overload1.C +++ b/gcc/testsuite/g++.old-deja/g++.other/overload1.C @@ -4,7 +4,7 @@ struct A { A operator+ (A, float); -main () +int main () { A a; a + 1; diff --git a/gcc/testsuite/g++.old-deja/g++.other/rttid4.C b/gcc/testsuite/g++.old-deja/g++.other/rttid4.C index 72100b7409d..d77ff3b0b0d 100644 --- a/gcc/testsuite/g++.old-deja/g++.other/rttid4.C +++ b/gcc/testsuite/g++.old-deja/g++.other/rttid4.C @@ -1,111 +1,6 @@ -// test of rtti of single inheritance and multiple inheritance with -// virtual inheritance -// dynamic casting -// Special g++ Options: -frtti -w - -#include <typeinfo> - -extern "C" { - int printf(const char *, ...); - void exit(int); -} - -class X { - public: - int xi; - virtual int f() {}; -}; - -class Y : public virtual X { - short ys; -}; - -class Z : public virtual Y { - int zi; -}; - -Z z; -Y y; -Y *yp = &z; -X *xp = &z; -Z *zp = &z; - -class A { -public: - int Ai; - virtual int a() {}; -}; - -class B { -public: - int Bi; - virtual int g() {}; -}; - -class D : public virtual A, private B { - int Di; -}; - -class E : public virtual D, public B { - int Ei; -}; - -class F : public E, public virtual D { - int Fi; -}; - -D d; -A *ap = &d; -B *bp = (B *)&d; -F f; -F *fp = &f; -A *aap = &f; -D *dp = &f; -E *ep = &f; -B *bbp = (B *)dp; - -void *vp = zp; - -/* -void error (int i) -{ - printf("FAIL\n"); - exit(i); -} -*/ - -void error (int i) -{ - exit(i); -} - -int main () -{ - vp = (void *)0; - - vp = dynamic_cast<Y *> (&z); - if (vp == 0) error(11); - - vp = dynamic_cast<Z *> (yp); - if (vp == 0) error(11); - - vp = dynamic_cast<X *> (yp); - if (vp == 0) error(12); - - vp = dynamic_cast<D *> (dp); - if (vp != (void *)dp) error(21); - - vp = dynamic_cast<B *> (dp); - if (vp == (void *)dp) error(21); - - vp = dynamic_cast<B *> (fp); - if (vp == (void *)bbp) error(22); - - vp = dynamic_cast<void *> (aap); - if (vp != (void *)fp) error(23); - - vp = dynamic_cast<B *> (aap); - if (vp == (void *)bbp) error(24); - -} - +// Special g++ Options: -w + // Ill-formed: dynamic_cast to private or ambiguous base + // vp = dynamic_cast<B *> (dp); + // if (vp == (void *)dp) error(21); + // vp = dynamic_cast<B *> (fp); + // if (vp == (void *)bbp) error(22); diff --git a/gcc/testsuite/g++.old-deja/g++.other/singleton.C b/gcc/testsuite/g++.old-deja/g++.other/singleton.C index c2c481075ff..075d83ac79a 100644 --- a/gcc/testsuite/g++.old-deja/g++.other/singleton.C +++ b/gcc/testsuite/g++.old-deja/g++.other/singleton.C @@ -1,4 +1,3 @@ -// execution test - re-initialization of statics XFAIL *-*-* // This tests two things: // 1. there is an annoying warning. // singleton.C:26: warning: `class singleton' only defines private constructors and has no friends diff --git a/gcc/testsuite/g++.old-deja/g++.pt/array1.C b/gcc/testsuite/g++.old-deja/g++.pt/array1.C index 436b4efaf77..669600f0443 100644 --- a/gcc/testsuite/g++.old-deja/g++.pt/array1.C +++ b/gcc/testsuite/g++.old-deja/g++.pt/array1.C @@ -3,7 +3,7 @@ template <class T, unsigned N> template <class T, unsigned N> unsigned size(T const (&)[N]) { return N; } -main() { +int main() { short iarray[] = { 1, 2, 3, 4, 5 }; const short carray[] = { 1, 2, 3, 4, 5 }; return size(iarray) - size(carray); diff --git a/gcc/testsuite/g++.old-deja/g++.pt/crash10.C b/gcc/testsuite/g++.old-deja/g++.pt/crash10.C index 974cafc8731..033e2341c24 100644 --- a/gcc/testsuite/g++.old-deja/g++.pt/crash10.C +++ b/gcc/testsuite/g++.old-deja/g++.pt/crash10.C @@ -6,6 +6,6 @@ public: enum { val = (N == 0) ? M : GCD<N, M % N>::val }; }; -main() { +int main() { GCD< 1, 0 >::val; // ERROR - division } diff --git a/gcc/testsuite/g++.old-deja/g++.pt/crash21.C b/gcc/testsuite/g++.old-deja/g++.pt/crash21.C index 4944d118edd..c84809b38dc 100644 --- a/gcc/testsuite/g++.old-deja/g++.pt/crash21.C +++ b/gcc/testsuite/g++.old-deja/g++.pt/crash21.C @@ -1,6 +1,5 @@ // Build don't link: // Special g++ Options: -// crash test - XFAIL class Pooled { diff --git a/gcc/testsuite/g++.old-deja/g++.pt/crash5.C b/gcc/testsuite/g++.old-deja/g++.pt/crash5.C index 786cdf2c902..5797eee23e6 100644 --- a/gcc/testsuite/g++.old-deja/g++.pt/crash5.C +++ b/gcc/testsuite/g++.old-deja/g++.pt/crash5.C @@ -3,7 +3,7 @@ template <class T, int i> struct K { void f(); -}; +}; // ERROR - forward declaration template <class T> void diff --git a/gcc/testsuite/g++.old-deja/g++.pt/crash8.C b/gcc/testsuite/g++.old-deja/g++.pt/crash8.C index 2fd687ac819..deff42dba89 100644 --- a/gcc/testsuite/g++.old-deja/g++.pt/crash8.C +++ b/gcc/testsuite/g++.old-deja/g++.pt/crash8.C @@ -27,7 +27,7 @@ void doit(T x) { p2 = TestClass2(); // ERROR - template used as expression } -main() { +int main() { double x; doit(x); } diff --git a/gcc/testsuite/g++.old-deja/g++.pt/enum5.C b/gcc/testsuite/g++.old-deja/g++.pt/enum5.C index fc88afa92d3..f6feefb5608 100644 --- a/gcc/testsuite/g++.old-deja/g++.pt/enum5.C +++ b/gcc/testsuite/g++.old-deja/g++.pt/enum5.C @@ -1,4 +1,4 @@ // Build don't link: template <> -enum E {e}; // ERROR - template declaration of enum XFAIL *-*-* +enum E {e}; // ERROR - template declaration of enum diff --git a/gcc/testsuite/g++.old-deja/g++.pt/explicit1.C b/gcc/testsuite/g++.old-deja/g++.pt/explicit1.C index 0daf54f2373..d218474ec8b 100644 --- a/gcc/testsuite/g++.old-deja/g++.pt/explicit1.C +++ b/gcc/testsuite/g++.old-deja/g++.pt/explicit1.C @@ -5,5 +5,5 @@ void foo(T t) {} void bar() { - &foo<double>; + (void (*)(double)) &foo<double>; } diff --git a/gcc/testsuite/g++.old-deja/g++.pt/explicit2.C b/gcc/testsuite/g++.old-deja/g++.pt/explicit2.C index 4d88c397f7d..73880315b64 100644 --- a/gcc/testsuite/g++.old-deja/g++.pt/explicit2.C +++ b/gcc/testsuite/g++.old-deja/g++.pt/explicit2.C @@ -5,5 +5,5 @@ void foo(T t) {} void bar() { - (void (*)(int)) &foo<double>; + (void (*)(int)) (void (*)(double)) &foo<double>; } diff --git a/gcc/testsuite/g++.old-deja/g++.pt/explicit22.C b/gcc/testsuite/g++.old-deja/g++.pt/explicit22.C index 2cb23381653..0f06c53f8fc 100644 --- a/gcc/testsuite/g++.old-deja/g++.pt/explicit22.C +++ b/gcc/testsuite/g++.old-deja/g++.pt/explicit22.C @@ -1,10 +1,10 @@ // Build don't link: // GROUPS passed templates template <class T, class U> -T foo(T t, U* u); // ERROR - template candidate +T foo(T t, U* u); template <class T> -T foo(T t, T* t); // ERROR - template candidate +T foo(T t, T* u); template <> -int foo<int>(int, int*); // ERROR - ambiguous template specialization +int foo<int>(int, int*); diff --git a/gcc/testsuite/g++.old-deja/g++.pt/explicit26.C b/gcc/testsuite/g++.old-deja/g++.pt/explicit26.C index eba8d79e292..7d1616255b2 100644 --- a/gcc/testsuite/g++.old-deja/g++.pt/explicit26.C +++ b/gcc/testsuite/g++.old-deja/g++.pt/explicit26.C @@ -8,5 +8,5 @@ int foo(int i) { return 0; } int main() { - &foo<int>; + (int (*)(int)) &foo<int>; } diff --git a/gcc/testsuite/g++.old-deja/g++.pt/explicit27.C b/gcc/testsuite/g++.old-deja/g++.pt/explicit27.C index 4a5adb59e70..a8d82211fc2 100644 --- a/gcc/testsuite/g++.old-deja/g++.pt/explicit27.C +++ b/gcc/testsuite/g++.old-deja/g++.pt/explicit27.C @@ -8,5 +8,5 @@ void foo(int i) {} int main() { - &foo<int>; + (void (*)(int)) &foo<int>; } diff --git a/gcc/testsuite/g++.old-deja/g++.pt/explicit28.C b/gcc/testsuite/g++.old-deja/g++.pt/explicit28.C index b842b893289..0133f16c5af 100644 --- a/gcc/testsuite/g++.old-deja/g++.pt/explicit28.C +++ b/gcc/testsuite/g++.old-deja/g++.pt/explicit28.C @@ -8,5 +8,5 @@ int foo(int i) { return 0; } int main() { - return (*&foo<int>)(3); + return (*((int (*)(int)) &foo<int>))(3); } diff --git a/gcc/testsuite/g++.old-deja/g++.pt/explicit30.C b/gcc/testsuite/g++.old-deja/g++.pt/explicit30.C index 5a697135c46..468dd7914b6 100644 --- a/gcc/testsuite/g++.old-deja/g++.pt/explicit30.C +++ b/gcc/testsuite/g++.old-deja/g++.pt/explicit30.C @@ -7,5 +7,5 @@ void foo(T, T*); void bar() { double d; - (*((void (*)(int, double*)) &foo<int>))(3, &d); + (*((void (*)(int, double*)) (void (*)(int, int*)) &foo<int>))(3, &d); } diff --git a/gcc/testsuite/g++.old-deja/g++.pt/explicit73.C b/gcc/testsuite/g++.old-deja/g++.pt/explicit73.C index 106f573c625..1dd0f69ab22 100644 --- a/gcc/testsuite/g++.old-deja/g++.pt/explicit73.C +++ b/gcc/testsuite/g++.old-deja/g++.pt/explicit73.C @@ -7,9 +7,9 @@ // the template namespace N { - template <class T> class foo; + template <class T> class foo; // ERROR - referenced below } using namespace N; -template <> class foo<void>; // ERROR - invalid specialization - XFAIL *-*-* +template <> class foo<void>; // ERROR - invalid specialization diff --git a/gcc/testsuite/g++.old-deja/g++.pt/friend11.C b/gcc/testsuite/g++.old-deja/g++.pt/friend11.C index d70fae6e0c8..1aeba3a1018 100644 --- a/gcc/testsuite/g++.old-deja/g++.pt/friend11.C +++ b/gcc/testsuite/g++.old-deja/g++.pt/friend11.C @@ -20,7 +20,7 @@ class C template <class U> friend void S<T>::f(U); - int i; + int i; // ERROR - private }; diff --git a/gcc/testsuite/g++.old-deja/g++.pt/friend21.C b/gcc/testsuite/g++.old-deja/g++.pt/friend21.C index c89fe1dc1d2..3f690a4404a 100644 --- a/gcc/testsuite/g++.old-deja/g++.pt/friend21.C +++ b/gcc/testsuite/g++.old-deja/g++.pt/friend21.C @@ -7,7 +7,7 @@ template <class T> struct A { template <class T> class B { friend class A<T>; - static int i; + static int i; // ERROR - private }; template <class T> class C diff --git a/gcc/testsuite/g++.old-deja/g++.pt/friend3.C b/gcc/testsuite/g++.old-deja/g++.pt/friend3.C index 77aabd3bee3..74d0e06699c 100644 --- a/gcc/testsuite/g++.old-deja/g++.pt/friend3.C +++ b/gcc/testsuite/g++.old-deja/g++.pt/friend3.C @@ -7,7 +7,7 @@ class C { friend void f<>(double); - int i; + int i; // ERROR - private }; diff --git a/gcc/testsuite/g++.old-deja/g++.pt/friend34.C b/gcc/testsuite/g++.old-deja/g++.pt/friend34.C index 8ba2c739d30..56eb80a5056 100644 --- a/gcc/testsuite/g++.old-deja/g++.pt/friend34.C +++ b/gcc/testsuite/g++.old-deja/g++.pt/friend34.C @@ -1,5 +1,5 @@ // Build don't link: -// excess errors test - XFAIL *-*-* +// excess errors test // This testcase won't fail if class ::foo is forward-declared in the // global namespace, nor if class bar is not a template class. diff --git a/gcc/testsuite/g++.old-deja/g++.pt/friend38.C b/gcc/testsuite/g++.old-deja/g++.pt/friend38.C index e3a6a060ef6..41c7714acc5 100644 --- a/gcc/testsuite/g++.old-deja/g++.pt/friend38.C +++ b/gcc/testsuite/g++.old-deja/g++.pt/friend38.C @@ -2,7 +2,9 @@ // Overly simplified from testcase by "B. K. Oxley" <binkley@bigfoot.com> +// crash test - XFAIL *-*-* + template<class P> struct foo { typedef P parent_type; - friend parent_type; // ERROR - template parameters cannot be friends - XFAIL *-*-* + friend parent_type; // ERROR - template parameters cannot be friends }; diff --git a/gcc/testsuite/g++.old-deja/g++.pt/m1.C b/gcc/testsuite/g++.old-deja/g++.pt/m1.C index 2d1321380be..8b13acb23d9 100644 --- a/gcc/testsuite/g++.old-deja/g++.pt/m1.C +++ b/gcc/testsuite/g++.old-deja/g++.pt/m1.C @@ -1,16 +1 @@ -// Build don't link: - -int f1 () { - struct A { - A() : b (2) { } - fred () { return b.hi_mom; } - struct B { - int hi_mom; - B (int a) { hi_mom = a; } - }; - B b; - }; - A aa; - return aa.fred(); -} -/* crashes with signal 11 */ + int fred () { return b.hi_mom; } diff --git a/gcc/testsuite/g++.old-deja/g++.pt/memclass1.C b/gcc/testsuite/g++.old-deja/g++.pt/memclass1.C index 2a9a6f6c02e..5ad839c231e 100644 --- a/gcc/testsuite/g++.old-deja/g++.pt/memclass1.C +++ b/gcc/testsuite/g++.old-deja/g++.pt/memclass1.C @@ -5,7 +5,7 @@ template <class T> struct A { }; }; -main () +int main () { A<int>::B<char> b; b.f (42); diff --git a/gcc/testsuite/g++.old-deja/g++.pt/memclass2.C b/gcc/testsuite/g++.old-deja/g++.pt/memclass2.C index 2fc5c31a40e..895fd6128e3 100644 --- a/gcc/testsuite/g++.old-deja/g++.pt/memclass2.C +++ b/gcc/testsuite/g++.old-deja/g++.pt/memclass2.C @@ -8,7 +8,7 @@ template <class T> struct A { }; }; -main () +int main () { A<int>::B<char> b; b.f (42); diff --git a/gcc/testsuite/g++.old-deja/g++.pt/memclass3.C b/gcc/testsuite/g++.old-deja/g++.pt/memclass3.C index 2174a3b17b0..77744f854a9 100644 --- a/gcc/testsuite/g++.old-deja/g++.pt/memclass3.C +++ b/gcc/testsuite/g++.old-deja/g++.pt/memclass3.C @@ -13,7 +13,7 @@ template <class T> struct A { }; }; -main () +int main () { A<int>::B<int>::C<int>::D<int>::E<int>::F<int> b; b.f (42); diff --git a/gcc/testsuite/g++.old-deja/g++.pt/memclass4.C b/gcc/testsuite/g++.old-deja/g++.pt/memclass4.C index de490e09a83..4c101c6609d 100644 --- a/gcc/testsuite/g++.old-deja/g++.pt/memclass4.C +++ b/gcc/testsuite/g++.old-deja/g++.pt/memclass4.C @@ -15,7 +15,7 @@ struct alloc_traits typedef typename Allocator::template rebind<T>::other allocator_type; }; -main () +int main () { typedef alloc_traits<int, allocator<void> >::allocator_type at; diff --git a/gcc/testsuite/g++.old-deja/g++.pt/memclass5.C b/gcc/testsuite/g++.old-deja/g++.pt/memclass5.C index 69b3bcc3e17..06a1413eb0e 100644 --- a/gcc/testsuite/g++.old-deja/g++.pt/memclass5.C +++ b/gcc/testsuite/g++.old-deja/g++.pt/memclass5.C @@ -16,7 +16,7 @@ void f () template <class T> struct C: public A<T>::B<T> { }; -main () +int main () { f<int, char>(); } diff --git a/gcc/testsuite/g++.old-deja/g++.pt/memtemp43.C b/gcc/testsuite/g++.old-deja/g++.pt/memtemp43.C index 0948f828279..3d8e3ad7cff 100644 --- a/gcc/testsuite/g++.old-deja/g++.pt/memtemp43.C +++ b/gcc/testsuite/g++.old-deja/g++.pt/memtemp43.C @@ -8,7 +8,7 @@ public: void operator=(A<U, N> const & a) { return; } }; -main() +int main() { A<float, 3> a; A<double, 3> b; diff --git a/gcc/testsuite/g++.old-deja/g++.pt/memtemp44.C b/gcc/testsuite/g++.old-deja/g++.pt/memtemp44.C index e6d2f879397..c8d6f163c4d 100644 --- a/gcc/testsuite/g++.old-deja/g++.pt/memtemp44.C +++ b/gcc/testsuite/g++.old-deja/g++.pt/memtemp44.C @@ -13,7 +13,7 @@ public: void func(U v1) {} }; -main() +int main() { A<float> a; a.func(3); diff --git a/gcc/testsuite/g++.old-deja/g++.pt/memtemp45.C b/gcc/testsuite/g++.old-deja/g++.pt/memtemp45.C index f8bb4789fbd..d71f25d07d5 100644 --- a/gcc/testsuite/g++.old-deja/g++.pt/memtemp45.C +++ b/gcc/testsuite/g++.old-deja/g++.pt/memtemp45.C @@ -13,7 +13,7 @@ public: void func(U v1 = 0) {} }; -main() +int main() { A<float> a; a.func(3); diff --git a/gcc/testsuite/g++.old-deja/g++.pt/memtemp46.C b/gcc/testsuite/g++.old-deja/g++.pt/memtemp46.C index e841ae899c5..2212a52123f 100644 --- a/gcc/testsuite/g++.old-deja/g++.pt/memtemp46.C +++ b/gcc/testsuite/g++.old-deja/g++.pt/memtemp46.C @@ -13,7 +13,7 @@ public: void func(V v1 = 0) {} }; -main() +int main() { A<float, int> a; a.func("abc"); diff --git a/gcc/testsuite/g++.old-deja/g++.pt/memtemp63.C b/gcc/testsuite/g++.old-deja/g++.pt/memtemp63.C index 6b7fc8e44f9..4f793d40e53 100644 --- a/gcc/testsuite/g++.old-deja/g++.pt/memtemp63.C +++ b/gcc/testsuite/g++.old-deja/g++.pt/memtemp63.C @@ -6,7 +6,7 @@ A<int> a; template <class T> template <class U> void A<T>::f (U u) { } -main() +int main() { a.f (24); } diff --git a/gcc/testsuite/g++.old-deja/g++.pt/memtemp67.C b/gcc/testsuite/g++.old-deja/g++.pt/memtemp67.C index bcf59606384..7170c9027b8 100644 --- a/gcc/testsuite/g++.old-deja/g++.pt/memtemp67.C +++ b/gcc/testsuite/g++.old-deja/g++.pt/memtemp67.C @@ -5,7 +5,7 @@ struct A operator A<T2>() const { return A<T2>(); } }; -main() +int main() { A<int> a1; A<long> a2; diff --git a/gcc/testsuite/g++.old-deja/g++.pt/memtemp69.C b/gcc/testsuite/g++.old-deja/g++.pt/memtemp69.C index 18932194a27..4c9a2a91ca7 100644 --- a/gcc/testsuite/g++.old-deja/g++.pt/memtemp69.C +++ b/gcc/testsuite/g++.old-deja/g++.pt/memtemp69.C @@ -24,7 +24,7 @@ struct X void f(const T1&) {} }; -main(int ac, char* av[]) { +int main(int ac, char* av[]) { S s; s.g(); int i[] = {1,2,3,4,5}; diff --git a/gcc/testsuite/g++.old-deja/g++.pt/overload5.C b/gcc/testsuite/g++.old-deja/g++.pt/overload5.C index ca1a0d3b2d7..058f4f4325c 100644 --- a/gcc/testsuite/g++.old-deja/g++.pt/overload5.C +++ b/gcc/testsuite/g++.old-deja/g++.pt/overload5.C @@ -1,8 +1,6 @@ // Build don't link: -// crash test - XFAIL *-*-* - -template <class T> void foo(); +template <class T> void foo(); // ERROR - candidate void (*bar)() = foo<void>; void (*baz)() = foo; // ERROR - can't deduce T diff --git a/gcc/testsuite/g++.old-deja/g++.pt/spec20.C b/gcc/testsuite/g++.old-deja/g++.pt/spec20.C index 497a32d7554..c6b699d9411 100644 --- a/gcc/testsuite/g++.old-deja/g++.pt/spec20.C +++ b/gcc/testsuite/g++.old-deja/g++.pt/spec20.C @@ -1,11 +1,16 @@ // Build don't link: +// According to the non-normative example in +// [temp.class.spec.mfunc]/2, these should be valid, but the grammar +// in the Standard does not allow partial nor full specializations as +// member-declarations, so we'd better not support them. + template <class T> struct S { template <class U> void f(U); - template <> void f<int>(int); // ERROR - specialization + template <> void f<int>(int); // ERROR - invalid specialization template <class V> struct I {}; template <class V> struct I<V*> {}; - template <> struct I<int>; // ERROR - specialization + template <> struct I<int>; // ERROR - invalid specialization }; diff --git a/gcc/testsuite/g++.old-deja/g++.pt/spec22.C b/gcc/testsuite/g++.old-deja/g++.pt/spec22.C index 88d55d38db6..e170b6e3476 100644 --- a/gcc/testsuite/g++.old-deja/g++.pt/spec22.C +++ b/gcc/testsuite/g++.old-deja/g++.pt/spec22.C @@ -11,5 +11,5 @@ struct S template <class T> template <> // ERROR - enclosing classes not specialized void S<T>::f<int> () -{ +{ // ERROR - template does not match any declaration } diff --git a/gcc/testsuite/g++.old-deja/g++.pt/static3.C b/gcc/testsuite/g++.old-deja/g++.pt/static3.C index b3040acb0f5..724355e4257 100644 --- a/gcc/testsuite/g++.old-deja/g++.pt/static3.C +++ b/gcc/testsuite/g++.old-deja/g++.pt/static3.C @@ -1,3 +1,7 @@ +// On targets that don't support weak symbols, we require an explicit +// instantiation of arr. +// excess errors test - XFAIL *-*-aout *-*-coff + template<class T> struct A { static T arr[5]; @@ -6,7 +10,7 @@ struct A { template <class T> T A<T>::arr[5] = { 0, 1, 2, 3, 4 }; -main () +int main () { return A<int>::arr[0]; } diff --git a/gcc/testsuite/g++.old-deja/g++.pt/static_cast.C b/gcc/testsuite/g++.old-deja/g++.pt/static_cast.C index f4c334eaf5d..26f26c56fc9 100644 --- a/gcc/testsuite/g++.old-deja/g++.pt/static_cast.C +++ b/gcc/testsuite/g++.old-deja/g++.pt/static_cast.C @@ -16,7 +16,7 @@ template<class R> void f(R) accumulate(0, static_cast<int (*)(int, R&)>(p) ); } -main() +int main() { f(0); } diff --git a/gcc/testsuite/g++.old-deja/g++.pt/t16.C b/gcc/testsuite/g++.old-deja/g++.pt/t16.C index a5b19e43fa6..fca7aa3a92f 100644 --- a/gcc/testsuite/g++.old-deja/g++.pt/t16.C +++ b/gcc/testsuite/g++.old-deja/g++.pt/t16.C @@ -1,30 +1 @@ -extern "C" void printf (char *, ...); -template <class T> T max (const T&x, const T&y) -{ - return (x>y)?x:y; -} -int min (const float&, const float&); -int min (const int& i1, const int& i2) { - return (i1 < i2) ? i1 : i2; -} - -class complex -{ - double re, im; - public: - complex (double r, double i=0) { re = r; im = i; } - friend int operator > (const complex& x, const complex &y) { return 0; } - void print () { } -}; - -main () -{ - complex c1 (1, 0); - complex c2 (2, 0); - - int j = max (1, 37); - complex m1 = max (c1, c2); - m1.print (); - printf ("j=%d\n", j); - return 0; -} +int main () diff --git a/gcc/testsuite/g++.old-deja/g++.pt/tiemann2.C b/gcc/testsuite/g++.old-deja/g++.pt/tiemann2.C index 31465d86025..fca7aa3a92f 100644 --- a/gcc/testsuite/g++.old-deja/g++.pt/tiemann2.C +++ b/gcc/testsuite/g++.old-deja/g++.pt/tiemann2.C @@ -1,34 +1 @@ -extern "C" void printf (char *, ...); -template <class T> T max (const T&x, const T&y) -{ - return (x>y)?x:y; -} - -class complex -{ - double re, im; - public: - complex (double r, double i=0) { re = r; im = i; } - friend int operator > (const complex& x, const complex &y); - void print () { printf ("re = %g; im = %g;\n", re, im); } -}; -int operator >(const complex& x, const complex &y) -{ - double c1 = x.re * x.re + x.im * x.im; - double c2 = y.re * y.re + y.im * y.im; - return c1 > c2; -} - -main () -{ - complex c1 (1, 0); - complex c2 (2, 0); - complex c3 (2, 3); - complex c4 (2, 1); - - complex m1 = max (c1, c2); - complex m2 = max (c3, c4); - m1.print (); - m2.print (); - return 0; -} +int main () diff --git a/gcc/testsuite/g++.old-deja/g++.pt/tt2.C b/gcc/testsuite/g++.old-deja/g++.pt/tt2.C index c4323a50340..c0033749484 100644 --- a/gcc/testsuite/g++.old-deja/g++.pt/tt2.C +++ b/gcc/testsuite/g++.old-deja/g++.pt/tt2.C @@ -1,22 +1,7 @@ -// Build don't link: - -int f1 () { + int fred () { return b.hi_mom; } struct A { - A() : b (2) { } - fred () { return b.hi_mom; } - struct B { - int hi_mom; - B (int a) { hi_mom = a; } - }; - B b; + ~A() { a = 3; } + int a; + int fred () { return a + 1; } }; - A aa; - return aa.fred(); -} -int f2 () { - struct A { ~A() { a = 3; } int a; fred () { return a + 1; } }; - A ab; - ab.a = 12; - return ab.fred(); -} diff --git a/gcc/testsuite/g++.old-deja/g++.pt/ttp14.C b/gcc/testsuite/g++.old-deja/g++.pt/ttp14.C index 3b284ae8700..04877d65b75 100644 --- a/gcc/testsuite/g++.old-deja/g++.pt/ttp14.C +++ b/gcc/testsuite/g++.old-deja/g++.pt/ttp14.C @@ -17,7 +17,7 @@ template<class E,template<class> class DD = D> class C int f(); }; -template<class E,template<class> class DD = D> int C<E,DD>::f() +template<class E,template<class> class DD> int C<E,DD>::f() { DD<E> d2; return d2.f(); diff --git a/gcc/testsuite/g++.old-deja/g++.pt/ttp3.C b/gcc/testsuite/g++.old-deja/g++.pt/ttp3.C index 9a047a846f0..322dd1991e3 100644 --- a/gcc/testsuite/g++.old-deja/g++.pt/ttp3.C +++ b/gcc/testsuite/g++.old-deja/g++.pt/ttp3.C @@ -10,5 +10,5 @@ template<template<class> class D,class E> class C int main() { - C<D,int> c; // ERROR - param list not match + C<D,int> c; // ERROR - param list not match// WARNING - sees it as not having a type } diff --git a/gcc/testsuite/g++.old-deja/g++.pt/typename3.C b/gcc/testsuite/g++.old-deja/g++.pt/typename3.C index 0b19d54723e..55d6430f2ef 100644 --- a/gcc/testsuite/g++.old-deja/g++.pt/typename3.C +++ b/gcc/testsuite/g++.old-deja/g++.pt/typename3.C @@ -16,6 +16,6 @@ struct B : public A<U> template <class U> -A<U>::A_Type B<U>::Func() +B<U>::A_Type B<U>::Func() { } diff --git a/gcc/testsuite/g++.old-deja/g++.pt/typename6.C b/gcc/testsuite/g++.old-deja/g++.pt/typename6.C index 0b19d54723e..a3df71840e7 100644 --- a/gcc/testsuite/g++.old-deja/g++.pt/typename6.C +++ b/gcc/testsuite/g++.old-deja/g++.pt/typename6.C @@ -1,3 +1,5 @@ +// We don't try to make implicit typename handle this case. + // Build don't link: // Special g++ Options: @@ -11,11 +13,10 @@ struct A template <class U> struct B : public A<U> { - A_Type Func(); + A_Type Func(); // ERROR - candidate }; - template <class U> A<U>::A_Type B<U>::Func() -{ +{ // ERROR - no match } diff --git a/gcc/testsuite/g++.old-deja/g++.pt/typename8.C b/gcc/testsuite/g++.old-deja/g++.pt/typename8.C index d2eb4cede91..86881f51127 100644 --- a/gcc/testsuite/g++.old-deja/g++.pt/typename8.C +++ b/gcc/testsuite/g++.old-deja/g++.pt/typename8.C @@ -16,7 +16,7 @@ public: } }; -class B : public A< B > +class B : public A< B > // ERROR - forward declaration { public: typedef int myT; diff --git a/gcc/testsuite/g++.old-deja/g++.robertl/eb125.C b/gcc/testsuite/g++.old-deja/g++.robertl/eb125.C index 5faa28087c8..aff6ae61007 100644 --- a/gcc/testsuite/g++.old-deja/g++.robertl/eb125.C +++ b/gcc/testsuite/g++.old-deja/g++.robertl/eb125.C @@ -1,3 +1,6 @@ +// This is a crash test; we don't care how many normal errors we get. +// excess errors test - XFAIL *-*-* + struct test_box { void print(void); @@ -17,5 +20,4 @@ template <class BOX> void test(BOX *the_box) // ERROR - semicolon missing the_box->print(); }; -template void test<> (test_box *); // gets bogus error - test is declared XFAIL *-*-* - +template void test<> (test_box *); diff --git a/gcc/testsuite/g++.old-deja/g++.robertl/eb131.C b/gcc/testsuite/g++.old-deja/g++.robertl/eb131.C index faa391df4a4..d966fd9c01f 100644 --- a/gcc/testsuite/g++.old-deja/g++.robertl/eb131.C +++ b/gcc/testsuite/g++.old-deja/g++.robertl/eb131.C @@ -10,12 +10,11 @@ struct a { void bar( double ); void bar( float ); - void foo( void (a::*member)(float) ); // ERROR - + void foo( void (a::*member)(float) ); // ERROR - candidate }; a::a() { foo( &junk ); // ERROR - junk is an unqualified-id. - foo( &bar ); // ERROR - bar is an unqualified-id. XFAIL *-*-* + foo( &bar ); // ERROR - bar is an unqualified-id. } - diff --git a/gcc/testsuite/g++.old-deja/g++.robertl/eb26.C b/gcc/testsuite/g++.old-deja/g++.robertl/eb26.C index 1f9cc126f63..2374b557346 100644 --- a/gcc/testsuite/g++.old-deja/g++.robertl/eb26.C +++ b/gcc/testsuite/g++.old-deja/g++.robertl/eb26.C @@ -3,7 +3,6 @@ // cannot declare friend of enclosing class using its scope, works fine // without scope or for definition of foo::bar::f // -// excess errors test - XFAIL *-*-* class foo { @@ -18,6 +17,8 @@ public: }; }; +int foo::bar::x; + int foo::f() { return bar::x; } diff --git a/gcc/testsuite/g++.old-deja/g++.robertl/eb27.C b/gcc/testsuite/g++.old-deja/g++.robertl/eb27.C index edba6cd4da0..9e44f3af8b9 100644 --- a/gcc/testsuite/g++.old-deja/g++.robertl/eb27.C +++ b/gcc/testsuite/g++.old-deja/g++.robertl/eb27.C @@ -3,7 +3,6 @@ */ /* (w) 4.9.97 by Kurt Garloff <K.Garloff@ping.de> */ // Special g++ Options: -// crash test - XFAIL *-*-* // 8/28/1998 - This dies in add_conversions from dfs_walk, null CLASSTYPE_METHOD_VEC // for the test<T> record_type. This is marked as an expected failure for now, // until we actually fix it. diff --git a/gcc/testsuite/g++.old-deja/g++.robertl/eb36.C b/gcc/testsuite/g++.old-deja/g++.robertl/eb36.C index e01dbdae6db..415e5bdf6f4 100644 --- a/gcc/testsuite/g++.old-deja/g++.robertl/eb36.C +++ b/gcc/testsuite/g++.old-deja/g++.robertl/eb36.C @@ -1,5 +1,3 @@ -// Build don't link: - #include <vector> template <typename T=float> class foo { @@ -13,7 +11,7 @@ private: template <typename T> foo<T>::foo() :v(), t() {} -template <typename T=float> // ERROR - default parm for member template XFAIL *-*-* -foo<T>::foo(vector<int> v_) :v(v_), t() {} +template <typename T=float> +foo<T>::foo(vector<int> v_) :v(v_), t() {} // ERROR - default arg for member template foo<float> a; diff --git a/gcc/testsuite/g++.old-deja/g++.robertl/eb4.C b/gcc/testsuite/g++.old-deja/g++.robertl/eb4.C index 04858587d45..b51d3eafb98 100644 --- a/gcc/testsuite/g++.old-deja/g++.robertl/eb4.C +++ b/gcc/testsuite/g++.old-deja/g++.robertl/eb4.C @@ -6,7 +6,7 @@ class some_base { public: class base_func_args; - virtual void func(base_func_args &) = 0; + virtual void func(base_func_args &) = 0; // ERROR - referenced below }; class some_base::base_func_args diff --git a/gcc/testsuite/g++.old-deja/g++.robertl/eb42.C b/gcc/testsuite/g++.old-deja/g++.robertl/eb42.C deleted file mode 100644 index 8850f9fa639..00000000000 --- a/gcc/testsuite/g++.old-deja/g++.robertl/eb42.C +++ /dev/null @@ -1,19 +0,0 @@ -//Build don't link: -#include <vector.h> -#include <algo.h> - -template <class T> class Expr -{ -public : -Expr(){}; -Expr(const T&){}; -}; - -template <class T > -inline bool compare(const Expr<T> a, const Expr<T> b){ return true; }; - -int main() -{ -vector<int> a(3); -sort( a.begin(), a.end(), compare ); // ERROR - no matching function -} diff --git a/gcc/testsuite/g++.old-deja/g++.robertl/eb43.C b/gcc/testsuite/g++.old-deja/g++.robertl/eb43.C index 8690d11a038..7f8647226c8 100644 --- a/gcc/testsuite/g++.old-deja/g++.robertl/eb43.C +++ b/gcc/testsuite/g++.old-deja/g++.robertl/eb43.C @@ -1,4 +1,7 @@ -// excess errors test - XFAIL *-*-* +// All the pointer_to_binary_function cases used to fail because g++ +// couldn't handle converting an overloaded function to a class type. +// The first one should still fail because it requires an implicit conversion +// to pointer_to_binary_function, which has an `explicit' constructor. #include <vector.h> #include <algo.h> @@ -13,7 +16,7 @@ public : template <class T > inline bool compare(const Expr<T> a, const Expr<T> b){ return true; }; -void main() +int main() { vector<int> a(3); sort( a.begin(), a.end(), @@ -21,7 +24,7 @@ void main() sort( a.begin(), a.end(), compare<int> ); sort<vector<int>::iterator, pointer_to_binary_function<const Expr<int>, const Expr<int>, bool> > - ( a.begin(), a.end(), compare ); + ( a.begin(), a.end(), compare ); // ERROR - constructor is explicit sort( a.begin(), a.end(), ptr_fun<const Expr<int>, const Expr<int>, bool> (compare) ); sort( a.begin(), a.end(), diff --git a/gcc/testsuite/g++.old-deja/g++.robertl/eb44.C b/gcc/testsuite/g++.old-deja/g++.robertl/eb44.C index 19c4bbf00ff..54eab153609 100644 --- a/gcc/testsuite/g++.old-deja/g++.robertl/eb44.C +++ b/gcc/testsuite/g++.old-deja/g++.robertl/eb44.C @@ -27,7 +27,7 @@ ostream& operator<< (ostream& out, const Vector<char>&) return out; } -main() +int main() { Vector<char> vc; ostream out; diff --git a/gcc/testsuite/g++.old-deja/g++.robertl/eb46.C b/gcc/testsuite/g++.old-deja/g++.robertl/eb46.C index 4b40322805d..ad077e38dc3 100644 --- a/gcc/testsuite/g++.old-deja/g++.robertl/eb46.C +++ b/gcc/testsuite/g++.old-deja/g++.robertl/eb46.C @@ -1,8 +1,9 @@ #include <iostream.h> class A1 { + friend class B; public: - virtual void foo() {friend class B;}; + virtual void foo() {}; }; class A2 : public virtual A1 {friend class B;}; diff --git a/gcc/testsuite/g++.old-deja/g++.robertl/eb59.C b/gcc/testsuite/g++.old-deja/g++.robertl/eb59.C index 4bc50b12e2a..7c0c1534ae4 100644 --- a/gcc/testsuite/g++.old-deja/g++.robertl/eb59.C +++ b/gcc/testsuite/g++.old-deja/g++.robertl/eb59.C @@ -21,7 +21,7 @@ template<class R> void f( vector<R>& v ) #endif } -main() +int main() { vector<int> r; f( r ); diff --git a/gcc/testsuite/g++.old-deja/g++.robertl/eb66.C b/gcc/testsuite/g++.old-deja/g++.robertl/eb66.C index e9a303afdf6..d79865f21d9 100644 --- a/gcc/testsuite/g++.old-deja/g++.robertl/eb66.C +++ b/gcc/testsuite/g++.old-deja/g++.robertl/eb66.C @@ -6,7 +6,7 @@ int bar () throw 100; } -main () +int main () { int i = 0; try diff --git a/gcc/testsuite/g++.old-deja/g++.robertl/eb69.C b/gcc/testsuite/g++.old-deja/g++.robertl/eb69.C index bd413ddacf5..9cc5f4a3ffe 100644 --- a/gcc/testsuite/g++.old-deja/g++.robertl/eb69.C +++ b/gcc/testsuite/g++.old-deja/g++.robertl/eb69.C @@ -6,4 +6,4 @@ typedef int an_int; bar() : bar::an_int(3) {}; // will call foo::foo(3) }; - main() { bar b; } +int main() { bar b; } diff --git a/gcc/testsuite/g++.old-deja/g++.robertl/eb70.C b/gcc/testsuite/g++.old-deja/g++.robertl/eb70.C index a82a399d540..30da1845973 100644 --- a/gcc/testsuite/g++.old-deja/g++.robertl/eb70.C +++ b/gcc/testsuite/g++.old-deja/g++.robertl/eb70.C @@ -1,19 +1,17 @@ // conversion ops should be treated as coming from the most derived class // for overload resolution. See [over.match.funcs]. // Build don't link: -// excess errors test - XFAIL *-*-* class X { public: - inline operator bool() const { return true; } + operator bool() const; }; class Y : public X { private: - inline operator void*() const { return 0; } + operator void*() const; }; - int f(Y const& y) { return bool(y); } diff --git a/gcc/testsuite/g++.old-deja/g++.robertl/eb78.C b/gcc/testsuite/g++.old-deja/g++.robertl/eb78.C index 15f26318efb..3baea64743d 100644 --- a/gcc/testsuite/g++.old-deja/g++.robertl/eb78.C +++ b/gcc/testsuite/g++.old-deja/g++.robertl/eb78.C @@ -119,6 +119,7 @@ tryIt(const String& filename) } } +int main() { tryIt("goodFile.txt"); diff --git a/gcc/testsuite/g++.old-deja/old-deja.exp b/gcc/testsuite/g++.old-deja/old-deja.exp index 072ed14d173..ff685b5d9f5 100644 --- a/gcc/testsuite/g++.old-deja/old-deja.exp +++ b/gcc/testsuite/g++.old-deja/old-deja.exp @@ -1,3 +1,4 @@ set dirlen [expr [string length "$srcdir/$subdir"] + 1]; set tfile [string range $file $dirlen end]; if ![runtest_file_p $runtests $tfile] then { + old-dejagnu $GXX_UNDER_TEST "$file" "$tfile" "" "$DEFAULT_CXXFLAGS" "-lstdc++" diff --git a/gcc/testsuite/g77.f-torture/execute/u77-test.f b/gcc/testsuite/g77.f-torture/execute/u77-test.f index bcb3270baa5..bb6e1e851db 100644 --- a/gcc/testsuite/g77.f-torture/execute/u77-test.f +++ b/gcc/testsuite/g77.f-torture/execute/u77-test.f @@ -233,9 +233,12 @@ C the better to test with, my dear! (-- burley) end do i = lstat ('foo', fstatb) do i=1,13 - if (fstatb (i) .ne. statb (i)) then - write (6,*) '*** LSTAT and STAT don''t agree on '// ' - + array element ', i, ' value ', fstatb (i), statb (i) +c For some reason that I haven't investigated, some people see +c failures with the 7th element which doesn't seem to indicate a u77 +c bug. + if (fstatb (i) .ne. statb (i) .and. i .ne. 7) then + write (6,*) '*** LSTAT and STAT don''t agree on '// + + 'array element ', i, ' value ', fstatb (i), statb (i) call abort end if end do diff --git a/gcc/testsuite/gcc.c-torture/ChangeLog b/gcc/testsuite/gcc.c-torture/ChangeLog index 6663d8a8dbb..dade5118447 100644 --- a/gcc/testsuite/gcc.c-torture/ChangeLog +++ b/gcc/testsuite/gcc.c-torture/ChangeLog @@ -1,3 +1,58 @@ +Mon Mar 22 14:55:58 1999 Jim Wilson <wilson@cygnus.com> + + * execute/bf-sign-2.c (main): Replace struct sizeof test with 4. + +Wed Mar 17 12:22:39 1999 Richard Henderson <rth@cygnus.com> + + * gcc.c-torture/execute/ieee/980619-1.x: New. Expected fail on x86. + +Fri Mar 12 16:17:28 1999 Jim Wilson <wilson@cygnus.com> + + * execute/970312-1.c, execute/980605-1.c (f): Change printf to sprintf. + * execute/bf-sign-2.c (struct X): Add u15 field. + (main): Add check for u15. Conditionalize u31 check depending on + whether ints are <32 bits or >=32 bits. + +1999-03-01 Zack Weinberg <zack@rabi.columbia.edu> + + * noncompile/noncompile.exp (951025-1.c): Accept an error + message on line 1 or line 2; cccp and cpplib do this differently. + +1999-02-03 Nick Clifton <nickc@cygnus.com> + + * execute/memcheck/blkarg.c (foo): Use 10 leading arguments in + order to force structure S onto the stack even on the alpha. + (test): Pass 10 leading arguments to function foo as well as the + structure S. + + * execute/memcheck/blkarg.x: New file: Expected failure for all + targets. + + * execute/memcheck/driver.c (main): Use exit or abort to terminate + program execution. + +1999-01-28 Michael Meissner <meissner@cygnus.com> + + * execute/990128-1.c: New test. + +1999-01-27 Michael Meissner <meissner@cygnus.com> + + * execute/990127-{1,2}.c: New tests. + +1998-12-14 Nick Clifton <nickc@cygnus.com> + + * execute/920501-4.c (main): Fix typo: replace | with ||. + +1998-11-30 Nick Clifton <nickc@cygnus.com> + + * execute/981130-1.c: New test. + * execute/981130-1.x: New test failure expectations. + +Sun Oct 11 05:04:28 1998 Ken Raeburn <raeburn@cygnus.com> + + * execute/memcheck: New directory of tests for + -fcheck-memory-usage. + 1998-10-06 Ken Raeburn <raeburn@cygnus.com> * special/981006-1.c: New test. Make sure gcc doesn't lose track @@ -9,6 +64,10 @@ Thu Oct 1 17:15:26 1998 Nick Clifton <nickc@cygnus.com> * compile/981001-1.c: New test. * execute/981001-1.c: New test. +Mon Aug 31 12:00:00 1998 Catherine Moore <clm@cygnus.com> + + * execute/941014-1.x: New file. + Wed Aug 26 16:10:00 1997 J"orn Rennecke <amylaar@cygnus.co.uk> * execute/loop-4b.c: New test. diff --git a/gcc/testsuite/gcc.c-torture/compile/981001-4.c b/gcc/testsuite/gcc.c-torture/compile/981001-4.c index 2ec5d8b2605..dd3df9cce4b 100644 --- a/gcc/testsuite/gcc.c-torture/compile/981001-4.c +++ b/gcc/testsuite/gcc.c-torture/compile/981001-4.c @@ -1,7 +1,7 @@ #define P(a,b) P1(a,b) #define P1(a,b) a##b -#define ONCE(x, y) (x ?: x = y()) +#define ONCE(x, y) (x ?: (x = y())) #define PREFIX extern int P(PREFIX, init) (void); diff --git a/gcc/testsuite/gcc.c-torture/execute/920501-4.c b/gcc/testsuite/gcc.c-torture/execute/920501-4.c index b936c4984b6..46b0da1f7de 100644 --- a/gcc/testsuite/gcc.c-torture/execute/920501-4.c +++ b/gcc/testsuite/gcc.c-torture/execute/920501-4.c @@ -1,6 +1,24 @@ -#ifndef NO_LABEL_VALUES -x(int i){static const void*j[]={&&x,&&y,&&z};goto*j[i];x:return 2;y:return 3;z:return 5;} -main(){if(x(0)!=2||x(1)!=3|x(2)!=5)abort();exit(0);} -#else -main(){ exit (0); } -#endif +int +x (int i) +{ + static const void *j[] = {&& x, && y, && z}; + + goto *j[i]; + + x: return 2; + y: return 3; + z: return 5; +} + +int +main (void) +{ + if ( x (0) != 2 + || x (1) != 3 + || x (2) != 5) + abort (); + + exit (0); +} +int +main (void) { exit (0); } diff --git a/gcc/testsuite/gcc.c-torture/execute/970312-1.c b/gcc/testsuite/gcc.c-torture/execute/970312-1.c index b303c4a8e60..9342edee478 100644 --- a/gcc/testsuite/gcc.c-torture/execute/970312-1.c +++ b/gcc/testsuite/gcc.c-torture/execute/970312-1.c @@ -1,71 +1,3 @@ -#include <stdio.h> +char buf[10]; -__inline__ static int -dummy (x) -{ - int y; - y = (long) (x * 4711.3); - return y; -} - -int getval (void); - -int -f2 (double x) -{ - unsigned short s; - int a, b, c, d, e, f, g, h, i, j; - - a = getval (); - b = getval (); - c = getval (); - d = getval (); - e = getval (); - f = getval (); - g = getval (); - h = getval (); - i = getval (); - j = getval (); - - - s = x; - - return a + b + c + d + e + f + g + h + i + j + s; -} - -int x = 1; - -int -getval (void) -{ - return x++; -} - -void -f () -{ - int a, b, c, d, e, f, g, h, i, j, k; - - a = getval (); - b = getval (); - c = getval (); - d = getval (); - e = getval (); - f = getval (); - g = getval (); - h = getval (); - i = getval (); - j = getval (); - - k = f2 (17.0); - - printf ("%d\n", a + b + c + d + e + f + g + h + i + j + k); - if (a + b + c + d + e + f + g + h + i + j + k != 227) - abort (); -} - -main () -{ - f (); - exit (0); -} + sprintf (buf, "%d\n", a + b + c + d + e + f + g + h + i + j + k); diff --git a/gcc/testsuite/gcc.c-torture/execute/980526-1.c b/gcc/testsuite/gcc.c-torture/execute/980526-1.c index 491068f9b64..57a910e4366 100644 --- a/gcc/testsuite/gcc.c-torture/execute/980526-1.c +++ b/gcc/testsuite/gcc.c-torture/execute/980526-1.c @@ -29,7 +29,9 @@ static void do2(void){ } int main(void){ +#ifndef NO_LABEL_VALUES do1(); do2(); +#endif exit(0); } diff --git a/gcc/testsuite/gcc.c-torture/execute/980605-1.c b/gcc/testsuite/gcc.c-torture/execute/980605-1.c index 5ce89a28a76..2fc2691e535 100644 --- a/gcc/testsuite/gcc.c-torture/execute/980605-1.c +++ b/gcc/testsuite/gcc.c-torture/execute/980605-1.c @@ -45,6 +45,8 @@ getval (void) return x++; } +char buf[10]; + void f () { @@ -64,7 +66,7 @@ f () k = f2 (17.0); - printf ("%d\n", a + b + c + d + e + f + g + h + i + j + k); + sprintf (buf, "%d\n", a + b + c + d + e + f + g + h + i + j + k); if (a + b + c + d + e + f + g + h + i + j + k != 227) abort (); } diff --git a/gcc/testsuite/gcc.c-torture/execute/bcp-1.c b/gcc/testsuite/gcc.c-torture/execute/bcp-1.c index 1eafec5beb9..38b1d3e8e93 100644 --- a/gcc/testsuite/gcc.c-torture/execute/bcp-1.c +++ b/gcc/testsuite/gcc.c-torture/execute/bcp-1.c @@ -11,6 +11,7 @@ inline int bad6(int x) { return __builtin_constant_p(x+1); } int bad7(void) { return __builtin_constant_p(abort()); } int bad8(void) { char buf[10]; return __builtin_constant_p(buf); } int bad9(const char *x) { return __builtin_constant_p(x[123456]); } +int bad10(void) { return __builtin_constant_p(&global); } /* These must pass, or we've broken gcc2 functionality. */ int good0(void) { return __builtin_constant_p(1); } @@ -20,14 +21,25 @@ int good2(void) { return __builtin_constant_p((1234 + 45) & ~7); } /* These are extensions to gcc2. Failure indicates an optimization regression. */ int opt0(void) { return bad3(1); } -int opt1(void) { return bad4("hi"); } -int opt2(void) { return bad6(1); } -int opt3(void) { return __builtin_constant_p(&global); } -int opt4(void) { return __builtin_constant_p("hi"[0]); } +int opt1(void) { return bad6(1); } +int opt2(void) { return __builtin_constant_p("hi"[0]); } + +/* + * Opt3 is known to fail. It is one of the important cases that glibc + * was interested in though, so keep this around as a reminder. + * + * The solution is to add bits to recover bytes from constant pool + * elements given nothing but a constant pool label and an offset. + * When we can do that, and we can simplify strlen after the fact, + * then we can enable recognition of constant pool labels as constants. + */ + +/* int opt3(void) { return bad4("hi"); } */ + /* Call through tables so -finline-functions can't screw with us. */ int (*bad_t0[])(void) = { - bad0, bad1, bad5, bad7, bad8 + bad0, bad1, bad5, bad7, bad8, bad10 }; int (*bad_t1[])(int x) = { @@ -43,7 +55,7 @@ int (*good_t0[])(void) = { }; int (*opt_t0[])(void) = { - opt0, opt1, opt2, opt3, opt4 + opt0, opt1, opt2 /* , opt3 */ }; #define N(arr) (sizeof(arr)/sizeof(*arr)) diff --git a/gcc/testsuite/gcc.c-torture/execute/bf-sign-2.c b/gcc/testsuite/gcc.c-torture/execute/bf-sign-2.c index 479082217eb..ede55918c31 100644 --- a/gcc/testsuite/gcc.c-torture/execute/bf-sign-2.c +++ b/gcc/testsuite/gcc.c-torture/execute/bf-sign-2.c @@ -1,52 +1,16 @@ -/* - This test checks promotion of bitfields. Bitfields should be promoted - very much like chars and shorts: - - Bitfields (signed or unsigned) should be promoted to signed int if their - value will fit in a signed int, otherwise to an unsigned int if their - value will fit in an unsigned int, otherwise we don't promote them (ANSI/ISO - does not specify the behavior of bitfields larger than an unsigned int). - - We test the behavior by subtracting two from the promoted value: this will - result in a negitive value for signed types, a positive value for unsigned - types. This test (of course) assumes that the compiler is correctly - implementing signed and unsigned arithmatic. - */ - -struct X { - unsigned int u3:3; - long int s31:31; - long int s32:32; - unsigned long int u31:31; - unsigned long int u32:32; - unsigned long long ull3 :3; - unsigned long long ull35:35; -}; - -struct X x; - -main () -{ - if ((x.u3 - 2) >= 0) /* promoted value should be signed */ - abort (); - - if ((x.s31 - 2) >= 0) /* promoted value should be signed */ - abort (); - - if ((x.s32 - 2) >= 0) /* promoted value should be signed */ - abort (); - - if ((x.u31 - 2) >= 0) /* promoted value should be signed */ - abort (); - - if ((x.u32 - 2) < 0) /* promoted value should be UNsigned */ - abort (); - - if ((x.ull3 - 2) >= 0) /* promoted value should be signed */ - abort (); - - if ((x.ull35 - 2) < 0) /* promoted value should be UNsigned */ - abort (); - - exit (0); -} + implementing signed and unsigned arithmetic. + unsigned u15:15; + if ((x.u15 - 2) >= 0) /* promoted value should be signed */ + + /* Conditionalize check on whether integers are 4 bytes or larger, i.e. + larger than a 31 bit bitfield. */ + if (sizeof (int) >= 4) + { + if ((x.u31 - 2) >= 0) /* promoted value should be signed */ + abort (); + } + else + { + if ((x.u31 - 2) < 0) /* promoted value should be UNsigned */ + abort (); + } diff --git a/gcc/testsuite/gcc.c-torture/noncompile/noncompile.exp b/gcc/testsuite/gcc.c-torture/noncompile/noncompile.exp index be7e234e492..ddebf06ddcf 100644 --- a/gcc/testsuite/gcc.c-torture/noncompile/noncompile.exp +++ b/gcc/testsuite/gcc.c-torture/noncompile/noncompile.exp @@ -225,7 +225,7 @@ postbase $src_code $run $groups # Test 951025-1.c prebase set src_code 951025-1.c -set compiler_output ".*:2:" +set compiler_output ".*:\[12\]:" set groups {passed gcc-noncompile} diff --git a/gcc/testsuite/gcc.c-torture/special/920521-1.c b/gcc/testsuite/gcc.c-torture/special/920521-1.c index 0f4dc08fb30..95b949798dc 100644 --- a/gcc/testsuite/gcc.c-torture/special/920521-1.c +++ b/gcc/testsuite/gcc.c-torture/special/920521-1.c @@ -1 +1 @@ -f(){asm("f":::"cc");}g(x){asm("g"::"%r"(x));} +f(){asm("f":::"cc");}g(x,y){asm("g"::"%r"(x), "r"(y));} diff --git a/gcc/testsuite/gcc.c-torture/special/930510-1.c b/gcc/testsuite/gcc.c-torture/special/930510-1.c index f973bc63321..26770f3455d 100644 --- a/gcc/testsuite/gcc.c-torture/special/930510-1.c +++ b/gcc/testsuite/gcc.c-torture/special/930510-1.c @@ -1,3 +1 @@ -#define ugly 3 -#ugly "foobar" 3 /* { dg-error "invalid" "invalid directive" } */ -main() { exit (0); } +int main() { exit (0); } diff --git a/gcc/testsuite/gcc.dg/980827-1.c b/gcc/testsuite/gcc.dg/980827-1.c index 33a496b9624..a841739c466 100644 --- a/gcc/testsuite/gcc.dg/980827-1.c +++ b/gcc/testsuite/gcc.dg/980827-1.c @@ -1,6 +1,8 @@ /* { dg-do run { target powerpc*-*-* } } */ /* { dg-options -O2 } */ +double dval = 0; + void splat (double d); int main(void) diff --git a/gcc/testsuite/gcc.dg/dll-1.c b/gcc/testsuite/gcc.dg/dll-1.c index 72c6ba5b24e..b9f7e3b775d 100644 --- a/gcc/testsuite/gcc.dg/dll-1.c +++ b/gcc/testsuite/gcc.dg/dll-1.c @@ -1,9 +1,2 @@ -/* { dg-do compile { target arm*-*-pe* } } */ -/* { dg-options -mno-nop-fun-dllimport } */ - -__declspec (dllimport) void imp (); - -__declspec (dllexport) void exp () { imp (); } - -/* { dg-final { scan-assembler dll-1.c "__imp_imp.*\.section\[ \t\]*.drectve\n\[^\n\]*-export:exp" } } */ -/* { dg-final { scan-assembler-not dll-1.c "__imp_exp" } } */ +/* { dg-do compile { target thumb*-*-pe* } } */ +/* { dg-final { scan-assembler dll-1.c "\.section\[ \t\]*.drectve\n\[^\n\]*-export:exp.*__imp_imp" } } */ diff --git a/gcc/testsuite/gcc.dg/dll-2.c b/gcc/testsuite/gcc.dg/dll-2.c index e49f6e2027d..1a28b189e7b 100644 --- a/gcc/testsuite/gcc.dg/dll-2.c +++ b/gcc/testsuite/gcc.dg/dll-2.c @@ -1,23 +1 @@ -/* These dllimport and dllexport appearing for a symbol. - The desired behaviour is that if both dllimport - and dllexport appear (in either order) the result is dllexport. - - Microsoft's MSVC 2.0 allows dllimport followed by dllexport for variables, - but does not allow dllexport followed by dllimport. - - In C, it's ok to redeclare a variable so this works for variables - and functions. In C++, it only works for functions. */ - -/* { dg-do compile { target arm*-*-pe* } } */ - -__declspec (dllimport) int foo1 (); -__declspec (dllexport) int foo1 (); - -__declspec (dllexport) int foo2 (); -__declspec (dllimport) int foo2 (); - -__declspec (dllimport) int bar1; -__declspec (dllexport) int bar1; - -__declspec (dllexport) int bar2; -__declspec (dllimport) int bar2; +/* { dg-do compile { target thumb*-*-pe* } } */ diff --git a/gcc/testsuite/gcc.dg/dll-3.c b/gcc/testsuite/gcc.dg/dll-3.c index 4976ebbbcc6..1a28b189e7b 100644 --- a/gcc/testsuite/gcc.dg/dll-3.c +++ b/gcc/testsuite/gcc.dg/dll-3.c @@ -1,15 +1 @@ -/* Ensure dllexport overrides dllimport. */ - -/* { dg-do compile { target arm*-*-pe* } } */ - -__declspec (dllimport) int foo1 (); -__declspec (dllexport) int foo1 (); - -__declspec (dllexport) int foo2 (); -__declspec (dllimport) int foo2 (); - -__declspec (dllexport) int foo1 () { return foo2 (); } -__declspec (dllexport) int foo2 () { return foo1 (); } - -/* { dg-final { scan-assembler dll-3.c "\.section\[ \t\]*\.drectve\n\[^\n\]*-export:foo1.*\.section\[ \t\]*\.drectve\n\[^\n\]*-export:foo2" } } */ -/* { dg-final { scan-assembler-not dll-3.c "(__imp_foo1|__imp_foo2)" } } */ +/* { dg-do compile { target thumb*-*-pe* } } */ diff --git a/gcc/testsuite/gcc.dg/dll-4.c b/gcc/testsuite/gcc.dg/dll-4.c index ae617861951..b50eafe1d3e 100644 --- a/gcc/testsuite/gcc.dg/dll-4.c +++ b/gcc/testsuite/gcc.dg/dll-4.c @@ -1,13 +1,2 @@ -/* { dg-do compile { target arm*-*-pe* } } */ - -__declspec (dllimport) int foo1; -int foo1; - -__declspec (dllimport) int foo2; -int foo2 = 5; - -int f () { return foo1 + foo2; } - -/* FIXME: We should scan the output of nm for this case. */ -/* { dg-final { scan-assembler dll-4.c "(\.comm\[ \t\]*foo1.*\nfoo2:|\nfoo2:.*\.comm\[ \t\]*foo1)" } } */ -/* { dg-final { scan-assembler-not dll-4.c "__imp_" } } */ +/* { dg-do compile { target thumb*-*-pe* } } */ +/* { dg-final { scan-assembler dll-4.c "(foo2:.*\.comm\[ \t_\]*foo1)" } } */ diff --git a/gcc/testsuite/gcc.misc-tests/gcov-1.c b/gcc/testsuite/gcc.misc-tests/gcov-1.c index 20fc950dddc..9196059e635 100644 --- a/gcc/testsuite/gcc.misc-tests/gcov-1.c +++ b/gcc/testsuite/gcc.misc-tests/gcov-1.c @@ -1,20 +1,2 @@ -/* Test Gcov basics. */ - -/* { dg-options "-fprofile-arcs -ftest-coverage" } */ -/* { dg-do run { target native } } */ - -noop () -{ -} - -main () -{ - int i; - - for (i = 0; i < 10; i++) /* count(11) */ - noop (); /* count(10) */ - - return 0; /* count(1) */ -} - -/* { dg-final { run-gcov gcov-1.c } } */ +void noop () +int main () diff --git a/gcc/testsuite/gcc.misc-tests/gcov-2.c b/gcc/testsuite/gcc.misc-tests/gcov-2.c index 3d64d8cad4e..9196059e635 100644 --- a/gcc/testsuite/gcc.misc-tests/gcov-2.c +++ b/gcc/testsuite/gcc.misc-tests/gcov-2.c @@ -1,21 +1,2 @@ -/* Test Gcov basics. */ - -/* { dg-prms-id 8294 } */ -/* { dg-options "-fprofile-arcs -ftest-coverage -g" } */ -/* { dg-do run { target native } } */ - -noop () -{ -} - -main () -{ - int i; - - for (i = 0; i < 10; i++) /* count(11) */ - noop (); /* count(10) */ - - return 0; /* count(1) */ -} - -int a_variable = 0; +void noop () +int main () diff --git a/gcc/testsuite/lib/c-torture.exp b/gcc/testsuite/lib/c-torture.exp index 3ff1de0e459..e2031d87bcd 100644 --- a/gcc/testsuite/lib/c-torture.exp +++ b/gcc/testsuite/lib/c-torture.exp @@ -1,4 +1,4 @@ -# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997 Free Software Foundation, Inc. +# Copyright (C) 1992-1998, 1999 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -23,16 +23,22 @@ # TORTURE_OPTIONS="{ { list1 } ... { listN } }" if ![info exists TORTURE_OPTIONS] { - # It is theoretically beneficial to group all of the O2 options together, + # It is theoretically beneficial to group all of the O2/O3 options together, # as in many cases the compiler will generate identical executables for # all of them--and the c-torture testsuite will skip testing identical # executables multiple times. + # Also note that -finline-functions is explicitly included in one of the + # items below, even though -O3 is also specified, because some ports may + # choose to disable inlining functions by default, even when optimizing. set TORTURE_OPTIONS [list \ - { -O0 } { -O1 } { -O2 } \ - { -O2 -fomit-frame-pointer -finline-functions } \ - { -O2 -fomit-frame-pointer -finline-functions -funroll-loops } \ - { -O2 -fomit-frame-pointer -finline-functions -funroll-all-loops } \ - { -O2 -g } { -Os } ] + { -O0 } \ + { -O1 } \ + { -O2 } \ + { -O3 -fomit-frame-pointer } \ + { -O3 -fomit-frame-pointer -funroll-loops } \ + { -O3 -fomit-frame-pointer -funroll-all-loops -finline-functions } \ + { -O3 -g } \ + { -Os } ] } @@ -76,50 +82,7 @@ proc c-torture-compile { src option } { lappend options "additional_flags=-w $option" set comp_output [gcc_target_compile "$src" "$output" object $options]; - - # Set a few common compiler messages. - set fatal_signal "*cc: Internal compiler error: program*got fatal signal" - - if [string match "$fatal_signal 6" $comp_output] then { - gcc_fail $testcase "Got Signal 6, $option" - remote_file build delete $output - return - } - - if [string match "$fatal_signal 11" $comp_output] then { - gcc_fail $testcase "Got Signal 11, $option" - remote_file build delete $output - return - } - - # We shouldn't get these because of -w, but just in case. - if [string match "*cc:*warning:*" $comp_output] then { - warning "$testcase: (with warnings) $option" - send_log "$comp_output\n" - unresolved "$testcase, $option" - remote_file build delete $output - return - } - - set comp_output [prune_warnings $comp_output] - - set unsupported_message [gcc_check_unsupported_p $comp_output] - if { $unsupported_message != "" } { - unsupported "$testcase: $unsupported_message" - remote_file build delete $output - return - } - - # remove any leftover LF/CR to make sure any output is legit - regsub -all -- "\[\r\n\]*" $comp_output "" comp_output - # If any message remains, we fail. - if ![string match "" $comp_output] then { - gcc_fail $testcase $option - remote_file build delete $output - return - } - - gcc_pass $testcase $option + gcc_check_compile $testcase $option $output $comp_output remote_file build delete $output } @@ -201,57 +164,17 @@ proc c-torture-execute { src args } { } set comp_output [gcc_target_compile "$src" "${execname}" executable $options]; - # Set a few common compiler messages. - set fatal_signal "*cc: Internal compiler error: program*got fatal signal" - - if [string match "$fatal_signal 6" $comp_output] then { - gcc_fail $testcase "Got Signal 6, $option" + if ![gcc_check_compile "$testcase compilation" $option $execname $comp_output] { + unresolved "$testcase execution, $option" remote_file build delete $execname continue } - - if [string match "$fatal_signal 11" $comp_output] then { - gcc_fail $testcase "Got Signal 11, $option" - remote_file build delete $execname - continue - } - - # We shouldn't get these because of -w, but just in case. - if [string match "*cc:*warning:*" $comp_output] then { - warning "$testcase: (with warnings) $option" - send_log "$comp_output\n" - unresolved "$testcase, $option" - remote_file build delete $execname - continue - } - - set comp_output [prune_warnings $comp_output] - - set unsupported_message [gcc_check_unsupported_p $comp_output] - - if { $unsupported_message != "" } { - unsupported "$testcase: $unsupported_message" - continue - } elseif ![file exists $execname] { - if ![is3way] { - fail "$testcase compilation, $option" - untested "$testcase execution, $option" - continue - } else { - # FIXME: since we can't test for the existance of a remote - # file without short of doing an remote file list, we assume - # that since we got no output, it must have compiled. - pass "$testcase compilation, $option" - } - } else { - pass "$testcase compilation, $option" - } # See if this source file uses "long long" types, if it does, and # no_long_long is set, skip execution of the test. if [target_info exists no_long_long] then { if [expr [search_for $src "long long"]] then { - untested "$testcase execution, $option" + unsupported "$testcase execution, $option" continue } } diff --git a/gcc/testsuite/lib/chill.exp b/gcc/testsuite/lib/chill.exp index bd8c4f64f2b..716021146f5 100644 --- a/gcc/testsuite/lib/chill.exp +++ b/gcc/testsuite/lib/chill.exp @@ -1,365 +1 @@ -# -# Expect script for Chill Regression Tests -# Copyright (C) 1993, 1996, 1997 Free Software Foundation -# -# This file is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# -# Written by Jeffrey Wheat (cassidy@cygnus.com) -# - -# -# chill support library procedures and testsuite specific instructions -# - -# -# default_chill_version -# extract and print the version number of the chill compiler -# exits if compiler does not exist -# -proc default_chill_version { } { - global GCC_UNDER_TEST - - # ignore any arguments after the command - set compiler [lindex $GCC_UNDER_TEST 0] - - # verify that the compiler exists - if {[which $compiler] != 0} then { - set tmp [ exec $compiler -v ] - regexp "version.*$" $tmp version - - if [info exists version] then { - clone_output "[which $compiler] $version\n" - } - } else { - warning "$compiler does not exist" - exit -1 - } -} - -# -# chill_compile -# compile the specified file -# -# returns values: -# return 0 on success -# return 1 on failure with $result containing compiler output -# exit with -1 if compiler doesn't exist -# -# verbosity output: -# 1 - indicate compile in progress -# 2 - indicate compile, target name -# 3 - indicate compile, target name, exec command, and result -# -proc chill_compile { src obj } { - global GCC_UNDER_TEST - global CFLAGS - - global errno - global result - global verbose - - global subdir - global tmpdir - - set errno 0 - set cflags $CFLAGS - set dumpfile [file rootname $obj].cmp ;# name of file to dump stderr in - - # verify that the compiler exists - if { [which $GCC_UNDER_TEST] == 0 } then { - warning "$GCC_UNDER_TEST does not exist" - exit -1 - } - - if { $verbose == 1 } then { - send_user "Compiling... " - } else { - verbose " - CMPL: Compiling [file tail $src]" 2 - } - - # if object type is a grt file, then only build a grant file - if [string match "*.grt" $obj] then { - set cflags [concat $cflags -fgrant-only] - } - - # build command line - set commandline "$GCC_UNDER_TEST $cflags -I$subdir -c $src" - - # write command line to logfile - send_log "\n### EXEC: $commandline\n" - - # tell us whats going on if verbose - verbose "### EXEC: $commandline" 3 - - # exec the compiler with the appropriate flags - set errno [catch "exec $commandline" result] - - # dump compiler's stderr output into $dumpfile - this is a gross hack - set dumpfile [open $dumpfile w+]; puts $dumpfile $result; close $dumpfile - - # log any compiler output unless its null - if ![string match "" $result] then { send_log "\n$result\n" } - unset cflags - return -} - -# -# chill_link -# link the specified files -# -# returns values: -# return 0 on success -# return 1 on failure with $result containing compiler output -# exit with -1 if compiler doesn't exist -# -# verbosity output: -# 1 - indicate linking in progress -# 2 - indicate linking, target name -# 3 - indicate linking, target name, exec command, and result -# -proc chill_link { target } { - global GCC_UNDER_TEST - global CFLAGS - - global errno - global result - global verbose - global tmptarget - - global crt0 - global libs - global objs - - set errno 0 - - # verify that the compiler exists - if { [which $GCC_UNDER_TEST] == 0 } then { - warning "$GCC_UNDER_TEST does not exist" - exit -1 - } - - if { $verbose == 1 } then { - send_user "Linking... " - } else { - verbose " - LINK: Linking [file tail $target]" 2 - } - - # verify that the object exists - if ![file exists $target.o] then { - set errno 1 - set result "file $target.o doesn'timeout exist" - return - } - - # build command line - set commandline "$GCC_UNDER_TEST $CFLAGS -o $target $target.o $objs $crt0 $libs" - - # write command line to logfile - send_log "\n### EXEC: $commandline\n" - - # tell us whats going on if we are verbose - verbose "### EXEC: $commandline" 3 - - # link the objects, sending any linker output to $result - set errno [catch "exec $commandline > $tmptarget.lnk" result] - - # log any linker output unless its null - if ![string match "" $result] then { send_log "\n$result\n" } - return -} - -# -# default_chill_start -# -proc default_chill_start { } { - global srcdir - global subdir - global tmpdir - global verbose - - if { $verbose > 1 } then { send_user "Configuring testsuite... " } - - # tmpdir is obtained from $objdir/site.exp. if not, set it to /tmp - if ![info exists tmpdir] then { set tmpdir /tmp } - - # save and convert $srcdir to an absolute pathname, stomp on the old value - # stomp on $subdir and set to the absolute path to the subdirectory - global osrcdir; set osrcdir $srcdir; set srcdir [cd $srcdir; pwd] - global osubdir; set osubdir $subdir; set subdir $srcdir/$subdir - - # cd the temporary directory, $tmpdir - cd $tmpdir; verbose "### PWD: [pwd]" 5 - - # copy init files to the tmpdir - foreach initfile [glob -nocomplain $subdir/*.init] { - set targfile $tmpdir/[file tail [file rootname $initfile]] - verbose "### EXEC: cp $initfile $targfile" 5 - if [catch "exec cp $initfile $targfile"] then { - send_user "\nConfigure failed.\n" - exit -1 - } - } - if { $verbose > 1 } then { send_user "Configuring finished.\n" } -} - -# -# default_chill_exit -# -# -proc default_chill_exit { } { - global srcdir - global objdir - global tmpdir - global osrcdir - global osubdir - - # reset directory variables - set srcdir $osrcdir; set subdir $osubdir - - # remove all generated targets and objects - verbose "### EXEC: rm -f $tmpdir/*" 3 - catch "exec rm -f $tmpdir/*" result - - # change back to the main object directory - cd $objdir - verbose "### SANITY: [pwd]" 5 -} - -# -# chill_diff -# compare two files line-by-line -# -# returns values: -# return 0 on success -# return 1 if different -# return -1 if output file doesn't exist -# -# verbosity output: -# 1 - indicate diffing in progress -# 2 - indicate diffing, target names -# 3 - indicate diffing, target names, and result -# -proc chill_diff { file_1 file_2 } { - global errno - global result - global target - global tmptarget - - global verbose - - set eof -1 - set errno 0 - set differences 0 - - if { $verbose == 1 } then { - send_user "Diffing... " - } else { - verbose " - DIFF: Diffing [file tail $file_1] [file tail $file_2]" 2 - } - - # write command line to logfile - send_log "### EXEC: diff $file_1 $file_2\n" - - # tell us whats going on if we are verbose - verbose "### EXEC: diff $file_1 $file_2" 3 - - # verify file exists and open it - if [file exists $file_1] then { - set file_a [open $file_1 r] - } else { - set errno -1; set result "$file_1 doesn't exist" - return - } - - # verify file exists and is not zero length, and then open it - if [file exists $file_2] then { - if [file size $file_2]!=0 then { - set file_b [open $file_2 r] - } else { - set errno -1; set result "$file_2 is zero bytes"; return - } - } else { - set errno -1; set result "$file_2 doesn't exist"; return - } - - # spoof the diff routine - lappend list_a $target - - while { [gets $file_a line] != $eof } { - if [regexp "^#.*$" $line] then { - continue - } else { - lappend list_a $line - } - } - close $file_a - - # spoof the diff routine - lappend list_b $target - - while { [gets $file_b line] != $eof } { - if [regexp "^#.*$" $line] then { - continue - } else { - # use [file tail $line] to strip off pathname - lappend list_b [file tail $line] - } - } - close $file_b - - for { set i 0 } { $i < [llength $list_a] } { incr i } { - set line_a [lindex $list_a $i] - set line_b [lindex $list_b $i] - - if [string compare $line_a $line_b] then { - set errno 1 - set count [expr $i+1] - set linenum [format %dc%d $count $count] - verbose "$linenum" 3 - verbose "< $line_a" 3 - verbose "---" 3 - verbose "> $line_b" 3 - - send_log "$file_1: < $count: $line_a\n" - send_log "$file_2: > $count: $line_b\n" - set result "differences found" - } - } - return -} - -# -# chill_fail -# a wrapper around the framework fail proc -# -proc chill_fail { target result } { - global verbose - - if { $verbose == 1 } then { send_user "\n" } - fail $target - verbose "--------------------------------------------------" 3 - verbose "### RESULT: $result" 3 -} - -# -# chill_pass -# a wrapper around the framework fail proc -# -proc chill_pass { target } { - global verbose - - if { $verbose == 1 } then { send_user "\n" } - pass $target -} + set result "file $target.o doesn't exist" diff --git a/gcc/testsuite/lib/f-torture.exp b/gcc/testsuite/lib/f-torture.exp index 2be2b3abef7..6596b6f2354 100644 --- a/gcc/testsuite/lib/f-torture.exp +++ b/gcc/testsuite/lib/f-torture.exp @@ -1,4 +1,4 @@ -# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997 Free Software Foundation, Inc. +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/gcc/testsuite/lib/g++.exp b/gcc/testsuite/lib/g++.exp index b0f6039544c..0cc681f3293 100644 --- a/gcc/testsuite/lib/g++.exp +++ b/gcc/testsuite/lib/g++.exp @@ -125,7 +125,6 @@ proc g++_init { args } { if ![is_remote host] { lappend ALWAYS_CXXFLAGS "additional_flags=[g++_include_flags]"; lappend ALWAYS_CXXFLAGS "ldflags=[g++_link_flags]"; - lappend ALWAYS_CXXFLAGS "incdir=$base_dir/../include" } if [info exists TOOL_OPTIONS] { @@ -157,6 +156,12 @@ proc g++_target_compile { source dest type options } { set options [concat $options "$ALWAYS_CXXFLAGS"]; + if { [regexp "(^| )-frepo( |$)" $options] && \ + [regexp "\.o(|bj)$" $dest] } then { + regsub "\.o(|bj)$" $dest ".rpo" rponame + exec rm -f $rponame + } + return [target_compile $source $dest $type $options] } diff --git a/gcc/testsuite/lib/gcc.exp b/gcc/testsuite/lib/gcc.exp index ac11d0ba26d..44dc08a6d4e 100644 --- a/gcc/testsuite/lib/gcc.exp +++ b/gcc/testsuite/lib/gcc.exp @@ -1,268 +1,55 @@ -# Copyright (C) 1992, 1993, 1994, 1996, 1997 Free Software Foundation, Inc. +# Copyright (C) 1992, 1993, 1994, 1996, 1997, 1999 Free Software Foundation, Inc. -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# Please email any bugs, comments, and/or additions to this file to: -# bug-gcc@prep.ai.mit.edu +# Reports pass/fail for a gcc compilation and returns true/false. +proc gcc_check_compile {testcase option objname gcc_output} { -# This file was written by Rob Savoye (rob@cygnus.com) -# Currently maintained by Doug Evans (dje@cygnus.com) - -# This file is loaded by the tool init file (eg: unix.exp). It provides -# default definitions for gcc_start, etc. and other supporting cast members. - -# These globals are used by gcc_start if no compiler arguments are provided. -# They are also used by the various testsuites to define the environment: -# where to find stdio.h, libc.a, etc. - -# we want to use libgloss so we can get find_gcc. -load_lib libgloss.exp - -# -# GCC_UNDER_TEST is the compiler under test. -# - -# -# default_gcc_version -- extract and print the version number of the compiler -# - -proc default_gcc_version { } { - global GCC_UNDER_TEST - - gcc_init; - - # ignore any arguments after the command - set compiler [lindex $GCC_UNDER_TEST 0] - - if ![is_remote host] { - set compiler_name [which $compiler]; - } else { - set compiler_name $compiler; - } - - # verify that the compiler exists - if { $compiler_name != 0 } then { - set tmp [remote_exec host "$compiler -v"] - set status [lindex $tmp 0]; - set output [lindex $tmp 1]; - regexp "version.*$" $output version - if { $status == 0 && [info exists version] } then { - clone_output "$compiler_name $version\n" - } else { - clone_output "Couldn't determine version of $compiler_name: $output\n" - } - } else { - # compiler does not exist (this should have already been detected) - warning "$compiler does not exist" - } -} - -# -# Call gcc_version. We do it this way so we can override it if needed. -# -proc gcc_version { } { - default_gcc_version; -} - -# -# gcc_init -- called at the start of each .exp script. -# -# There currently isn't much to do, but always using it allows us to -# make some enhancements without having to go back and rewrite the scripts. -# - -set gcc_initialized 0 - -proc gcc_init { args } { - global tmpdir - global libdir - global gluefile wrap_flags - global gcc_initialized - global GCC_UNDER_TEST - global TOOL_EXECUTABLE - - if { $gcc_initialized == 1 } { return; } - - if ![info exists GCC_UNDER_TEST] { - if [info exists TOOL_EXECUTABLE] { - set GCC_UNDER_TEST $TOOL_EXECUTABLE; - } else { - set GCC_UNDER_TEST "[find_gcc]" - } - } - - if ![info exists tmpdir] then { - set tmpdir /tmp - } - if { [target_info needs_status_wrapper]!="" && ![info exists gluefile] } { - set gluefile ${tmpdir}/testglue.o; - set result [build_wrapper $gluefile]; - if { $result != "" } { - set gluefile [lindex $result 0]; - set wrap_flags [lindex $result 1]; - } else { - unset gluefile - } - } -} - -proc gcc_target_compile { source dest type options } { - global tmpdir; - global gluefile wrap_flags; - global GCC_UNDER_TEST - global TOOL_OPTIONS - - if { [target_info needs_status_wrapper]!="" && [info exists gluefile] } { - lappend options "libs=${gluefile}" - lappend options "ldflags=$wrap_flags" + set fatal_signal "*cc: Internal compiler error: program*got fatal signal" + + if [string match "$fatal_signal 6" $gcc_output] then { + gcc_fail $testcase "Got Signal 6, $option" + return 0 } - if [target_info exists gcc,stack_size] { - lappend options "additional_flags=-DSTACK_SIZE=[target_info gcc,stack_size]" + if [string match "$fatal_signal 11" $gcc_output] then { + gcc_fail $testcase "Got Signal 11, $option" + return 0 } - if [target_info exists gcc,no_trampolines] { - lappend options "additional_flags=-DNO_TRAMPOLINES" - } - if [target_info exists gcc,no_label_values] { - lappend options "additional_flags=-DNO_LABEL_VALUES" - } - if [info exists TOOL_OPTIONS] { - lappend options "additional_flags=$TOOL_OPTIONS" - } - if [target_info exists gcc,no_varargs] { - lappend options "additional_flags=-DNO_VARARGS" - } - lappend options "compiler=$GCC_UNDER_TEST" - return [target_compile $source $dest $type $options] -} - -# -# gcc_pass -- utility to record a testcase passed -# -proc gcc_pass { testcase cflags } { - if { "$cflags" == "" } { - pass "$testcase" - } else { - pass "$testcase, $cflags" + # We shouldn't get these because of -w, but just in case. + if [string match "*cc:*warning:*" $gcc_output] then { + warning "$testcase: (with warnings) $option" + send_log "$gcc_output\n" + unresolved "$testcase, $option" + return 0 } -} -# -# gcc_fail -- utility to record a testcase failed -# + set gcc_output [prune_warnings $gcc_output] -proc gcc_fail { testcase cflags } { - if { "$cflags" == "" } { - fail "$testcase" - } else { - fail "$testcase, $cflags" + set unsupported_message [gcc_check_unsupported_p $gcc_output] + if { $unsupported_message != "" } { + unsupported "$testcase: $unsupported_message" + return 0 } -} - -# -# gcc_finish -- called at the end of every .exp script that calls gcc_init -# -# The purpose of this proc is to hide all quirks of the testing environment -# from the testsuites. It also exists to undo anything that gcc_init did -# (that needs undoing). -# -proc gcc_finish { } { - # The testing harness apparently requires this. - global errorInfo; + # remove any leftover LF/CR to make sure any output is legit + regsub -all -- "\[\r\n\]*" $gcc_output "" gcc_output - if [info exists errorInfo] then { - unset errorInfo + # If any message remains, we fail. + if ![string match "" $gcc_output] then { + gcc_fail $testcase $option + return 0 } - # Might as well reset these (keeps our caller from wondering whether - # s/he has to or not). - global prms_id bug_id - set prms_id 0 - set bug_id 0 -} - -proc gcc_exit { } { - global gluefile; - - if [info exists gluefile] { - file_on_build delete $gluefile; - unset gluefile; + # fail if the desired object file doesn't exist. + # FIXME: there's no way of checking for existence on a remote host. + if {$objname != "" && ![is3way] && ![file exists $objname]} { + gcc_fail $testcase $option + return 0 } -} - -# If this is an older version of dejagnu (without runtest_file_p), -# provide one and assume the old syntax: foo1.exp bar1.c foo2.exp bar2.c. -# This can be deleted after next dejagnu release. -if { [info procs runtest_file_p] == "" } then { - proc runtest_file_p { runtests testcase } { - if { $runtests != "" && [regexp "\[.\]\[cC\]" $runtests] } then { - if { [lsearch $runtests [file tail $testcase]] >= 0 } then { - return 1 - } else { - return 0 - } - } - return 1 - } + gcc_pass $testcase $option + return 1 } -# Provide a definition of this if missing (delete after next dejagnu release). - -if { [info procs prune_warnings] == "" } then { - proc prune_warnings { text } { - return $text - } -} - -# Utility used by mike-gcc.exp and c-torture.exp. -# Check the compiler(/assembler/linker) output for text indicating that -# the testcase should be marked as "unsupported". -# -# When dealing with a large number of tests, it's difficult to weed out the -# ones that are too big for a particular cpu (eg: 16 bit with a small amount -# of memory). There are various ways to deal with this. Here's one. -# Fortunately, all of the cases where this is likely to happen will be using -# gld so we can tell what the error text will look like. - -proc ${tool}_check_unsupported_p { output } { - if [regexp "(^|\n)\[^\n\]*: region \[^\n\]* is full" $output] { - return "memory full" - } - return "" -} - -# Prune messages from gcc that aren't useful. - -proc prune_gcc_output { text } { - #send_user "Before:$text\n" - regsub -all "(^|\n)\[^\n\]*: In (function|method) \[^\n\]*" $text "" text - regsub -all "(^|\n)\[^\n\]*: At top level:\[^\n\]*" $text "" text - - # It would be nice to avoid passing anything to gcc that would cause it to - # issue these messages (since ignoring them seems like a hack on our part), - # but that's too difficult in the general case. For example, sometimes - # you need to use -B to point gcc at crt0.o, but there are some targets - # that don't have crt0.o. - regsub -all "(^|\n)\[^\n\]*file path prefix \[^\n\]* never used" $text "" text - regsub -all "(^|\n)\[^\n\]*linker input file unused since linking not done" $text "" text - - #send_user "After:$text\n" - - return $text -} diff --git a/gcc/testsuite/lib/objc-torture.exp b/gcc/testsuite/lib/objc-torture.exp index 517d6ca5df4..5eadd489c47 100644 --- a/gcc/testsuite/lib/objc-torture.exp +++ b/gcc/testsuite/lib/objc-torture.exp @@ -169,7 +169,7 @@ proc objc-torture-execute { src } { verbose "Testing $testcase, $option" 1 set options "" - lappend options "additional_flags=-w $option" + lappend options "additional_flags=-w $option -I${srcdir}/../../libobjc" set comp_output [objc_target_compile "$src" "$executable" executable $options]; # Set a few common compiler messages. diff --git a/gcc/testsuite/lib/old-dejagnu.exp b/gcc/testsuite/lib/old-dejagnu.exp index 30d2236d423..bfa29b0643c 100644 --- a/gcc/testsuite/lib/old-dejagnu.exp +++ b/gcc/testsuite/lib/old-dejagnu.exp @@ -119,11 +119,7 @@ proc old-dejagnu-stat { } { # Returns 0 if successful, 1 if their were any errors. # PROG is the full path name of the file to compile. # -# CFLAGS_VAR is the name of the global variable containing compiler flags. -# We ignore this now. -# -# CFLAGS is the options to always pass to the compiler. -# This is also ignored. +# CFLAGSX is the options to always pass to the compiler. # # DEFAULT_CFLAGS are additional options if the testcase has none. # @@ -137,7 +133,7 @@ proc old-dejagnu-stat { } { # # Think of "cflags" here as "compiler flags", not "C compiler flags". -proc old-dejagnu { compiler prog cflagsx default_cflags libs } { +proc old-dejagnu { compiler prog name cflagsx default_cflags libs } { global verbose global tool global subdir ;# eg: g++.old-dejagnu @@ -196,9 +192,11 @@ proc old-dejagnu { compiler prog cflagsx default_cflags libs } { # is right. If no such Special Options are found, $default_cflags is used. # FIXME: Can there be multiple lines of these? # -# Other keywords: "Build don't link:", "Build don't run:". +# Other keywords: "Build don't link:", "Build don't run:", "Build then link:", +# "Additional sources: <file>.cc ..." - set name "[file tail [file dirname $prog]]/[file tail $prog]" +# $name is now passed in. +# set name "[file tail [file dirname $prog]]/[file tail $prog]" set tmp [grep $prog "FIXME -.*"] if ![string match "" $tmp] then { @@ -225,6 +223,16 @@ proc old-dejagnu { compiler prog cflagsx default_cflags libs } { lappend cflags "additional_flags=$cflagsx" } + set tmp [lindex [grep $prog "Additional sources: .*"] 0] + regsub -all "\n\[^\n\]+(\n|$)" $tmp "\n" tmp + set tmp [string trim $tmp] + if ![string match "" $tmp] then { + regsub "^.*Additional.*sources:" $tmp "" tmp + regsub -all " " $tmp " [file dirname $prog]/" tmp + lappend cflags "additional_flags=$tmp" + verbose "Adding sources $tmp" + } + lappend cflags "compiler=$compiler" regsub -all "\[./\]" "$name" "-" output; @@ -239,6 +247,15 @@ proc old-dejagnu { compiler prog cflagsx default_cflags libs } { verbose "Will compile $prog to object" 3 } + set tmp [lindex [grep $prog "Build then link:"] 0] + if ![string match "" $tmp] then { + set compile_type "object" + set runflag 2 + set final_output "$output" + set output "$tmpdir/[file tail [file rootname $prog]].o" + verbose "Will compile $prog to object, then link it" 3 + } + set tmp [lindex [grep $prog "Build don.t run:"] 0] if ![string match "" $tmp] then { set runflag 0 @@ -399,6 +416,11 @@ proc old-dejagnu { compiler prog cflagsx default_cflags libs } { # we can't run a.out when the compilation fails. remote_file build delete $output set comp_output [${tool}_target_compile $prog $output $compile_type $cflags] + if { $runflag == 2 && [file exists $output] } then { + set runflag 0 + set comp_output [concat $comp_output [${tool}_target_compile $output $final_output "executable" $cflags]] + set output $final_output + } # Delete things like "ld.so: warning" messages. set comp_output [prune_warnings $comp_output] @@ -510,6 +532,7 @@ proc old-dejagnu { compiler prog cflagsx default_cflags libs } { regsub -all "(^|\n)\[^\n\]*: At top level:\[^\n\]*" $comp_output "" comp_output regsub -all "(^|\n)\[^\n\]*file path prefix \[^\n\]* never used" $comp_output "" comp_output regsub -all "(^|\n)\[^\n\]*linker input file unused since linking not done" $comp_output "" comp_output + regsub -all "(^|\n)collect: re(compiling|linking)\[^\n\]*" $comp_output "" comp_output set unsupported_message [${tool}_check_unsupported_p $comp_output] if { $unsupported_message != "" } { |