Testcases for g++
Klaus-Georg Adams
Klaus-Georg.Adams@chemie.uni-karlsruhe.de
Tue Mar 17 04:06:00 GMT 1998
Hi Mike,
I have come accross your suggestion at
http://www.cygnus.com/ml/egcs/1998-Feb/1100.html
how to get new testcases for things broken in egcs.
I have a couple of testcases which expose bugs in the latest egcs.
There are comments in the testcases to make my intention clear, but
maybe you could look it through.
Thanks.
-- kga
PS: What is the magical incantation of `cvs diff' to get this with the
least pain?
-------------------------------------------------------------------------
Klaus-Georg Adams Email: Klaus-Georg.Adams@chemie.uni-karlsruhe.de
Institut f. Anorg. Chemie II Tel: 0721 608 3485
Uni Karlsruhe
-------------------------------------------------------------------------
diff -rcN egcs-cvs/gcc/testsuite/g++.old-deja/g++.broken/catch_undef.C egcs-own/gcc/testsuite/g++.old-deja/g++.broken/catch_undef.C
*** egcs-cvs/gcc/testsuite/g++.old-deja/g++.broken/catch_undef.C Thu Jan 1 01:00:00 1970
--- egcs-own/gcc/testsuite/g++.old-deja/g++.broken/catch_undef.C Tue Mar 17 13:00:39 1998
***************
*** 0 ****
--- 1,16 ----
+ // Build don't link:
+ //
+ // This I don't know how to tell deja. It is supposed to flag the
+ // error, but it gets an internal compiler error 109.
+
+ int main()
+ {
+ try {
+ }
+ catch (bad_alloc) { // ERROR - causes internal compiler error 109
+ return 1;
+ }
+ return 0;
+ }
+
+
diff -rcN egcs-cvs/gcc/testsuite/g++.old-deja/g++.broken/incompatible_fptr.C egcs-own/gcc/testsuite/g++.old-deja/g++.broken/incompatible_fptr.C
*** egcs-cvs/gcc/testsuite/g++.old-deja/g++.broken/incompatible_fptr.C Thu Jan 1 01:00:00 1970
--- egcs-own/gcc/testsuite/g++.old-deja/g++.broken/incompatible_fptr.C Tue Mar 17 12:59:44 1998
***************
*** 0 ****
--- 1,15 ----
+ // Build don't link:
+ //
+ // Demonstrate the lack of checking in assignment to function
+ // pointers.
+ // This is supposed not to compile (at least generate warnings),
+ // but egcs is happy with it.
+
+ void cheat_ptr( int* i ) { ++(*i); }
+ void cheat_ref( int& i ) { ++i; }
+
+ void foo()
+ {
+ void (*bar_ptr)( const int* ) = &cheat_ptr; // ERROR - incompatible signatures
+ void (*bar_ref)( const int& ) = &cheat_ref; // ERROR - incompatible signatures
+ }
diff -rcN egcs-cvs/gcc/testsuite/g++.old-deja/g++.broken/incompatible_mptr.C egcs-own/gcc/testsuite/g++.old-deja/g++.broken/incompatible_mptr.C
*** egcs-cvs/gcc/testsuite/g++.old-deja/g++.broken/incompatible_mptr.C Thu Jan 1 01:00:00 1970
--- egcs-own/gcc/testsuite/g++.old-deja/g++.broken/incompatible_mptr.C Tue Mar 17 12:59:36 1998
***************
*** 0 ****
--- 1,17 ----
+ // Build don't link:
+ //
+ // Demonstrate the lack of checking in assignment to member
+ // function pointers.
+ // This is supposed not to compile (at least generate warnings),
+ // but egcs is happy with it.
+
+ struct t {
+ void cheat_ptr( int* i ) { ++(*i); }
+ void cheat_ref( int& i ) { ++i; }
+ };
+
+ void foo()
+ {
+ void (t::*bar_ptr)( const int* ) = &t::cheat_ptr; // ERROR - incompatible signatures
+ void (t::*bar_ref)( const int& ) = &t::cheat_ref; // ERROR - incompatible signatures
+ }
diff -rcN egcs-cvs/gcc/testsuite/g++.old-deja/g++.broken/member_template_friend.C egcs-own/gcc/testsuite/g++.old-deja/g++.broken/member_template_friend.C
*** egcs-cvs/gcc/testsuite/g++.old-deja/g++.broken/member_template_friend.C Thu Jan 1 01:00:00 1970
--- egcs-own/gcc/testsuite/g++.old-deja/g++.broken/member_template_friend.C Tue Mar 17 12:59:03 1998
***************
*** 0 ****
--- 1,18 ----
+ // Build don't link:
+ // Check for template friends.
+ // This is supposed to compile, but doesn't.
+
+ template <class T> class t {
+ template <class T2> friend class t;
+ public:
+ template <class T2> void access( const t<T2>& x ) { data = x.data; }
+ private:
+ int data;
+ };
+
+ void foo()
+ {
+ t<int> one;
+ t<long> two;
+ one.access( two );
+ }
diff -rcN egcs-cvs/gcc/testsuite/g++.old-deja/g++.broken/mi.C egcs-own/gcc/testsuite/g++.old-deja/g++.broken/mi.C
*** egcs-cvs/gcc/testsuite/g++.old-deja/g++.broken/mi.C Thu Jan 1 01:00:00 1970
--- egcs-own/gcc/testsuite/g++.old-deja/g++.broken/mi.C Tue Mar 17 12:58:50 1998
***************
*** 0 ****
--- 1,22 ----
+ // Build don't link:
+ // Check for access problems with virtual inheritance.
+ // This is supposed to compile, but doesn't.
+
+ class A {
+ protected:
+ ~A() {}
+ };
+
+ class B : public virtual A {};
+
+ class C : public B {};
+
+ class D : public virtual C {};
+
+ int main()
+ {
+ B B;
+ C c;
+ D d;
+ return 0;
+ }
More information about the Gcc-bugs
mailing list