From 554fd8c5195424bdbcabf5de30fdc183aba391bd Mon Sep 17 00:00:00 2001 From: upstream source tree Date: Sun, 15 Mar 2015 20:14:05 -0400 Subject: obtained gcc-4.6.4.tar.bz2 from upstream website; verified gcc-4.6.4.tar.bz2.sig; imported gcc-4.6.4 source tree from verified upstream tarball. downloading a git-generated archive based on the 'upstream' tag should provide you with a source tree that is binary identical to the one extracted from the above tarball. if you have obtained the source via the command 'git clone', however, do note that line-endings of files in your working directory might differ from line-endings of the respective files in the upstream repository. --- gcc/testsuite/g++.old-deja/g++.jason/2371.C | 551 +++++++++++++++++++++ gcc/testsuite/g++.old-deja/g++.jason/3523.C | 40 ++ gcc/testsuite/g++.old-deja/g++.jason/access1.C | 17 + gcc/testsuite/g++.old-deja/g++.jason/access10.C | 14 + gcc/testsuite/g++.old-deja/g++.jason/access11.C | 12 + gcc/testsuite/g++.old-deja/g++.jason/access12.C | 16 + gcc/testsuite/g++.old-deja/g++.jason/access13.C | 15 + gcc/testsuite/g++.old-deja/g++.jason/access14.C | 10 + gcc/testsuite/g++.old-deja/g++.jason/access15.C | 18 + gcc/testsuite/g++.old-deja/g++.jason/access16.C | 20 + gcc/testsuite/g++.old-deja/g++.jason/access17.C | 24 + gcc/testsuite/g++.old-deja/g++.jason/access18.C | 24 + gcc/testsuite/g++.old-deja/g++.jason/access2.C | 11 + gcc/testsuite/g++.old-deja/g++.jason/access20.C | 39 ++ gcc/testsuite/g++.old-deja/g++.jason/access21.C | 22 + gcc/testsuite/g++.old-deja/g++.jason/access22.C | 22 + gcc/testsuite/g++.old-deja/g++.jason/access23.C | 80 +++ gcc/testsuite/g++.old-deja/g++.jason/access24.C | 11 + gcc/testsuite/g++.old-deja/g++.jason/access3.C | 12 + gcc/testsuite/g++.old-deja/g++.jason/access4.C | 14 + gcc/testsuite/g++.old-deja/g++.jason/access5.C | 12 + gcc/testsuite/g++.old-deja/g++.jason/access6.C | 12 + gcc/testsuite/g++.old-deja/g++.jason/access7.C | 13 + gcc/testsuite/g++.old-deja/g++.jason/access8.C | 30 ++ gcc/testsuite/g++.old-deja/g++.jason/access9.C | 9 + gcc/testsuite/g++.old-deja/g++.jason/aggregate.C | 14 + gcc/testsuite/g++.old-deja/g++.jason/ambig1.C | 7 + gcc/testsuite/g++.old-deja/g++.jason/ambig2.C | 11 + gcc/testsuite/g++.old-deja/g++.jason/ambig3.C | 16 + gcc/testsuite/g++.old-deja/g++.jason/anon.C | 19 + gcc/testsuite/g++.old-deja/g++.jason/anon2.C | 7 + gcc/testsuite/g++.old-deja/g++.jason/anon3.C | 25 + gcc/testsuite/g++.old-deja/g++.jason/anon4.C | 14 + gcc/testsuite/g++.old-deja/g++.jason/binding.C | 12 + gcc/testsuite/g++.old-deja/g++.jason/binding2.C | 15 + gcc/testsuite/g++.old-deja/g++.jason/binding3.C | 20 + gcc/testsuite/g++.old-deja/g++.jason/bool.C | 46 ++ gcc/testsuite/g++.old-deja/g++.jason/bool2.C | 15 + gcc/testsuite/g++.old-deja/g++.jason/bool3.C | 13 + gcc/testsuite/g++.old-deja/g++.jason/bool4.C | 11 + gcc/testsuite/g++.old-deja/g++.jason/bool5.C | 11 + gcc/testsuite/g++.old-deja/g++.jason/bool6.C | 9 + gcc/testsuite/g++.old-deja/g++.jason/bool7.C | 29 ++ gcc/testsuite/g++.old-deja/g++.jason/builtin.C | 10 + gcc/testsuite/g++.old-deja/g++.jason/builtin2.C | 8 + gcc/testsuite/g++.old-deja/g++.jason/byval.C | 20 + gcc/testsuite/g++.old-deja/g++.jason/byval2.C | 23 + gcc/testsuite/g++.old-deja/g++.jason/byval3.C | 14 + gcc/testsuite/g++.old-deja/g++.jason/c-inline.C | 11 + gcc/testsuite/g++.old-deja/g++.jason/cast1.C | 8 + gcc/testsuite/g++.old-deja/g++.jason/cast2.C | 15 + gcc/testsuite/g++.old-deja/g++.jason/cast3.C | 16 + gcc/testsuite/g++.old-deja/g++.jason/cleanup.C | 24 + gcc/testsuite/g++.old-deja/g++.jason/cleanup2.C | 15 + gcc/testsuite/g++.old-deja/g++.jason/complete1.C | 12 + gcc/testsuite/g++.old-deja/g++.jason/cond.C | 58 +++ gcc/testsuite/g++.old-deja/g++.jason/cond2.C | 66 +++ gcc/testsuite/g++.old-deja/g++.jason/condexp.C | 14 + gcc/testsuite/g++.old-deja/g++.jason/const.C | 17 + gcc/testsuite/g++.old-deja/g++.jason/const2.C | 15 + gcc/testsuite/g++.old-deja/g++.jason/const3.C | 11 + gcc/testsuite/g++.old-deja/g++.jason/const4.C | 25 + gcc/testsuite/g++.old-deja/g++.jason/context.C | 20 + gcc/testsuite/g++.old-deja/g++.jason/conversion.C | 16 + .../g++.old-deja/g++.jason/conversion10.C | 19 + .../g++.old-deja/g++.jason/conversion11.C | 29 ++ gcc/testsuite/g++.old-deja/g++.jason/conversion2.C | 7 + gcc/testsuite/g++.old-deja/g++.jason/conversion3.C | 8 + gcc/testsuite/g++.old-deja/g++.jason/conversion4.C | 14 + gcc/testsuite/g++.old-deja/g++.jason/conversion5.C | 13 + gcc/testsuite/g++.old-deja/g++.jason/conversion6.C | 41 ++ gcc/testsuite/g++.old-deja/g++.jason/conversion7.C | 17 + gcc/testsuite/g++.old-deja/g++.jason/conversion8.C | 11 + gcc/testsuite/g++.old-deja/g++.jason/conversion9.C | 14 + gcc/testsuite/g++.old-deja/g++.jason/crash1.C | 29 ++ gcc/testsuite/g++.old-deja/g++.jason/crash10.C | 8 + gcc/testsuite/g++.old-deja/g++.jason/crash11.C | 9 + gcc/testsuite/g++.old-deja/g++.jason/crash12.C | 10 + gcc/testsuite/g++.old-deja/g++.jason/crash3.C | 14 + gcc/testsuite/g++.old-deja/g++.jason/crash4.C | 38 ++ gcc/testsuite/g++.old-deja/g++.jason/crash5.C | 4 + gcc/testsuite/g++.old-deja/g++.jason/crash6.C | 9 + gcc/testsuite/g++.old-deja/g++.jason/crash7.C | 6 + gcc/testsuite/g++.old-deja/g++.jason/crash8.C | 10 + gcc/testsuite/g++.old-deja/g++.jason/crash9.C | 29 ++ gcc/testsuite/g++.old-deja/g++.jason/ctor1.C | 27 + gcc/testsuite/g++.old-deja/g++.jason/ctor2.C | 16 + gcc/testsuite/g++.old-deja/g++.jason/dcast1.C | 20 + gcc/testsuite/g++.old-deja/g++.jason/dcast2.C | 19 + gcc/testsuite/g++.old-deja/g++.jason/dcast3.C | 33 ++ gcc/testsuite/g++.old-deja/g++.jason/default1.C | 16 + gcc/testsuite/g++.old-deja/g++.jason/default2.C | 31 ++ gcc/testsuite/g++.old-deja/g++.jason/default3.C | 6 + gcc/testsuite/g++.old-deja/g++.jason/defctor.C | 16 + gcc/testsuite/g++.old-deja/g++.jason/delete1.C | 6 + gcc/testsuite/g++.old-deja/g++.jason/delete2.C | 16 + gcc/testsuite/g++.old-deja/g++.jason/delete3.C | 19 + gcc/testsuite/g++.old-deja/g++.jason/destruct.C | 34 ++ gcc/testsuite/g++.old-deja/g++.jason/destruct2.C | 20 + gcc/testsuite/g++.old-deja/g++.jason/destruct3.C | 45 ++ gcc/testsuite/g++.old-deja/g++.jason/destruct4.C | 14 + gcc/testsuite/g++.old-deja/g++.jason/dot.C | 20 + gcc/testsuite/g++.old-deja/g++.jason/dtor.C | 14 + gcc/testsuite/g++.old-deja/g++.jason/dtor2.C | 11 + gcc/testsuite/g++.old-deja/g++.jason/dtor3.C | 18 + gcc/testsuite/g++.old-deja/g++.jason/dtor4.C | 23 + gcc/testsuite/g++.old-deja/g++.jason/dtor5.C | 26 + gcc/testsuite/g++.old-deja/g++.jason/enum.C | 19 + gcc/testsuite/g++.old-deja/g++.jason/enum2.C | 8 + gcc/testsuite/g++.old-deja/g++.jason/enum3.C | 19 + gcc/testsuite/g++.old-deja/g++.jason/enum4.C | 10 + gcc/testsuite/g++.old-deja/g++.jason/enum5.C | 9 + gcc/testsuite/g++.old-deja/g++.jason/enum6.C | 27 + gcc/testsuite/g++.old-deja/g++.jason/enum7.C | 15 + gcc/testsuite/g++.old-deja/g++.jason/enum8.C | 21 + gcc/testsuite/g++.old-deja/g++.jason/explicit.C | 15 + gcc/testsuite/g++.old-deja/g++.jason/expr1.C | 12 + gcc/testsuite/g++.old-deja/g++.jason/friend.C | 20 + gcc/testsuite/g++.old-deja/g++.jason/friend2.C | 21 + gcc/testsuite/g++.old-deja/g++.jason/groff1.C | 41 ++ gcc/testsuite/g++.old-deja/g++.jason/hmc1.C | 19 + gcc/testsuite/g++.old-deja/g++.jason/incomplete1.C | 15 + gcc/testsuite/g++.old-deja/g++.jason/incomplete2.C | 7 + gcc/testsuite/g++.old-deja/g++.jason/init.C | 7 + gcc/testsuite/g++.old-deja/g++.jason/init2.C | 10 + gcc/testsuite/g++.old-deja/g++.jason/init3.C | 42 ++ gcc/testsuite/g++.old-deja/g++.jason/init4.C | 4 + gcc/testsuite/g++.old-deja/g++.jason/inline.C | 22 + gcc/testsuite/g++.old-deja/g++.jason/inline2.C | 12 + gcc/testsuite/g++.old-deja/g++.jason/inline3.C | 43 ++ gcc/testsuite/g++.old-deja/g++.jason/jump.C | 15 + gcc/testsuite/g++.old-deja/g++.jason/lex1.C | 7 + gcc/testsuite/g++.old-deja/g++.jason/lineno.C | 6 + gcc/testsuite/g++.old-deja/g++.jason/lineno2.C | 14 + gcc/testsuite/g++.old-deja/g++.jason/lineno3.C | 14 + gcc/testsuite/g++.old-deja/g++.jason/lineno4.C | 14 + gcc/testsuite/g++.old-deja/g++.jason/lineno5.C | 10 + gcc/testsuite/g++.old-deja/g++.jason/local.C | 21 + gcc/testsuite/g++.old-deja/g++.jason/lookup.C | 30 ++ gcc/testsuite/g++.old-deja/g++.jason/lookup2.C | 13 + gcc/testsuite/g++.old-deja/g++.jason/lookup3.C | 15 + gcc/testsuite/g++.old-deja/g++.jason/loverload.C | 11 + gcc/testsuite/g++.old-deja/g++.jason/loverload3.C | 12 + gcc/testsuite/g++.old-deja/g++.jason/loverload4.C | 8 + gcc/testsuite/g++.old-deja/g++.jason/lvalue.C | 22 + gcc/testsuite/g++.old-deja/g++.jason/lvalue2.C | 20 + gcc/testsuite/g++.old-deja/g++.jason/lvalue3.C | 9 + gcc/testsuite/g++.old-deja/g++.jason/lvalue4.C | 7 + gcc/testsuite/g++.old-deja/g++.jason/mangle1.C | 23 + gcc/testsuite/g++.old-deja/g++.jason/mangle2.C | 23 + gcc/testsuite/g++.old-deja/g++.jason/mangle3.C | 20 + gcc/testsuite/g++.old-deja/g++.jason/member.C | 35 ++ gcc/testsuite/g++.old-deja/g++.jason/method.C | 12 + gcc/testsuite/g++.old-deja/g++.jason/mi.C | 17 + gcc/testsuite/g++.old-deja/g++.jason/mutable1.C | 12 + gcc/testsuite/g++.old-deja/g++.jason/nested1.C | 12 + gcc/testsuite/g++.old-deja/g++.jason/nested2.C | 26 + gcc/testsuite/g++.old-deja/g++.jason/nested4.C | 17 + gcc/testsuite/g++.old-deja/g++.jason/nested5.C | 11 + gcc/testsuite/g++.old-deja/g++.jason/nested6.C | 5 + gcc/testsuite/g++.old-deja/g++.jason/nested7.C | 16 + gcc/testsuite/g++.old-deja/g++.jason/nested8.C | 8 + gcc/testsuite/g++.old-deja/g++.jason/net.C | 10 + gcc/testsuite/g++.old-deja/g++.jason/net2.C | 38 ++ gcc/testsuite/g++.old-deja/g++.jason/new.C | 26 + gcc/testsuite/g++.old-deja/g++.jason/new2.C | 13 + gcc/testsuite/g++.old-deja/g++.jason/new3.C | 38 ++ gcc/testsuite/g++.old-deja/g++.jason/new4.C | 23 + gcc/testsuite/g++.old-deja/g++.jason/new5.C | 6 + gcc/testsuite/g++.old-deja/g++.jason/offset1.C | 17 + gcc/testsuite/g++.old-deja/g++.jason/offset2.C | 24 + gcc/testsuite/g++.old-deja/g++.jason/offset3.C | 22 + gcc/testsuite/g++.old-deja/g++.jason/offset4.C | 15 + gcc/testsuite/g++.old-deja/g++.jason/opeq.C | 40 ++ gcc/testsuite/g++.old-deja/g++.jason/opeq2.C | 26 + gcc/testsuite/g++.old-deja/g++.jason/opeq3.C | 15 + gcc/testsuite/g++.old-deja/g++.jason/opeq4.C | 8 + gcc/testsuite/g++.old-deja/g++.jason/opeq5.C | 27 + gcc/testsuite/g++.old-deja/g++.jason/opeq6.C | 24 + gcc/testsuite/g++.old-deja/g++.jason/operator.C | 32 ++ gcc/testsuite/g++.old-deja/g++.jason/operator2.C | 14 + gcc/testsuite/g++.old-deja/g++.jason/opover.C | 15 + gcc/testsuite/g++.old-deja/g++.jason/optimize.C | 42 ++ gcc/testsuite/g++.old-deja/g++.jason/optimize2.C | 22 + gcc/testsuite/g++.old-deja/g++.jason/overload.C | 20 + gcc/testsuite/g++.old-deja/g++.jason/overload1.C | 12 + gcc/testsuite/g++.old-deja/g++.jason/overload11.C | 18 + gcc/testsuite/g++.old-deja/g++.jason/overload12.C | 16 + gcc/testsuite/g++.old-deja/g++.jason/overload13.C | 28 ++ gcc/testsuite/g++.old-deja/g++.jason/overload14.C | 10 + gcc/testsuite/g++.old-deja/g++.jason/overload15.C | 10 + gcc/testsuite/g++.old-deja/g++.jason/overload16.C | 8 + gcc/testsuite/g++.old-deja/g++.jason/overload17.C | 20 + gcc/testsuite/g++.old-deja/g++.jason/overload18.C | 6 + gcc/testsuite/g++.old-deja/g++.jason/overload19.C | 12 + gcc/testsuite/g++.old-deja/g++.jason/overload2.C | 12 + gcc/testsuite/g++.old-deja/g++.jason/overload20.C | 12 + gcc/testsuite/g++.old-deja/g++.jason/overload21.C | 13 + gcc/testsuite/g++.old-deja/g++.jason/overload22.C | 17 + gcc/testsuite/g++.old-deja/g++.jason/overload23.C | 27 + gcc/testsuite/g++.old-deja/g++.jason/overload24.C | 23 + gcc/testsuite/g++.old-deja/g++.jason/overload26.C | 22 + gcc/testsuite/g++.old-deja/g++.jason/overload27.C | 8 + gcc/testsuite/g++.old-deja/g++.jason/overload28.C | 13 + gcc/testsuite/g++.old-deja/g++.jason/overload29.C | 16 + gcc/testsuite/g++.old-deja/g++.jason/overload3.C | 12 + gcc/testsuite/g++.old-deja/g++.jason/overload30.C | 17 + gcc/testsuite/g++.old-deja/g++.jason/overload31.C | 24 + gcc/testsuite/g++.old-deja/g++.jason/overload32.C | 19 + gcc/testsuite/g++.old-deja/g++.jason/overload33.C | 78 +++ gcc/testsuite/g++.old-deja/g++.jason/overload34.C | 8 + gcc/testsuite/g++.old-deja/g++.jason/overload35.C | 25 + gcc/testsuite/g++.old-deja/g++.jason/overload36.C | 16 + gcc/testsuite/g++.old-deja/g++.jason/overload4.C | 11 + gcc/testsuite/g++.old-deja/g++.jason/overload5.C | 5 + gcc/testsuite/g++.old-deja/g++.jason/overload6.C | 15 + gcc/testsuite/g++.old-deja/g++.jason/overload7.C | 15 + gcc/testsuite/g++.old-deja/g++.jason/overload8.C | 7 + gcc/testsuite/g++.old-deja/g++.jason/overload9.C | 39 ++ gcc/testsuite/g++.old-deja/g++.jason/parse1.C | 8 + gcc/testsuite/g++.old-deja/g++.jason/parse10.C | 16 + gcc/testsuite/g++.old-deja/g++.jason/parse11.C | 9 + gcc/testsuite/g++.old-deja/g++.jason/parse12.C | 18 + gcc/testsuite/g++.old-deja/g++.jason/parse13.C | 8 + gcc/testsuite/g++.old-deja/g++.jason/parse14.C | 12 + gcc/testsuite/g++.old-deja/g++.jason/parse2.C | 6 + gcc/testsuite/g++.old-deja/g++.jason/parse3.C | 6 + gcc/testsuite/g++.old-deja/g++.jason/parse4.C | 7 + gcc/testsuite/g++.old-deja/g++.jason/parse5.C | 12 + gcc/testsuite/g++.old-deja/g++.jason/parse6.C | 9 + gcc/testsuite/g++.old-deja/g++.jason/parse7.C | 7 + gcc/testsuite/g++.old-deja/g++.jason/parse8.C | 2 + gcc/testsuite/g++.old-deja/g++.jason/parse9.C | 19 + gcc/testsuite/g++.old-deja/g++.jason/pmem.C | 11 + gcc/testsuite/g++.old-deja/g++.jason/pmem2.C | 44 ++ gcc/testsuite/g++.old-deja/g++.jason/pmem3.C | 12 + gcc/testsuite/g++.old-deja/g++.jason/pmem4.C | 11 + gcc/testsuite/g++.old-deja/g++.jason/pmf.C | 7 + gcc/testsuite/g++.old-deja/g++.jason/pmf2.C | 13 + gcc/testsuite/g++.old-deja/g++.jason/pmf3.C | 19 + gcc/testsuite/g++.old-deja/g++.jason/pmf4.C | 9 + gcc/testsuite/g++.old-deja/g++.jason/pmf5.C | 19 + gcc/testsuite/g++.old-deja/g++.jason/pmf6.C | 11 + gcc/testsuite/g++.old-deja/g++.jason/pmf7.C | 28 ++ gcc/testsuite/g++.old-deja/g++.jason/pmf8.C | 30 ++ gcc/testsuite/g++.old-deja/g++.jason/pmf9.C | 57 +++ gcc/testsuite/g++.old-deja/g++.jason/pmftemp.C | 16 + gcc/testsuite/g++.old-deja/g++.jason/precedence.C | 14 + gcc/testsuite/g++.old-deja/g++.jason/redecl1.C | 13 + gcc/testsuite/g++.old-deja/g++.jason/ref1.C | 8 + gcc/testsuite/g++.old-deja/g++.jason/ref10.C | 32 ++ gcc/testsuite/g++.old-deja/g++.jason/ref11.C | 18 + gcc/testsuite/g++.old-deja/g++.jason/ref12.C | 6 + gcc/testsuite/g++.old-deja/g++.jason/ref2.C | 6 + gcc/testsuite/g++.old-deja/g++.jason/ref3.C | 7 + gcc/testsuite/g++.old-deja/g++.jason/ref4.C | 4 + gcc/testsuite/g++.old-deja/g++.jason/ref5.C | 10 + gcc/testsuite/g++.old-deja/g++.jason/ref6.C | 3 + gcc/testsuite/g++.old-deja/g++.jason/ref7.C | 22 + gcc/testsuite/g++.old-deja/g++.jason/ref8.C | 18 + gcc/testsuite/g++.old-deja/g++.jason/ref9.C | 26 + gcc/testsuite/g++.old-deja/g++.jason/report.C | 77 +++ gcc/testsuite/g++.old-deja/g++.jason/return.C | 22 + gcc/testsuite/g++.old-deja/g++.jason/return2.C | 24 + gcc/testsuite/g++.old-deja/g++.jason/return3.C | 20 + gcc/testsuite/g++.old-deja/g++.jason/rfg1.C | 13 + gcc/testsuite/g++.old-deja/g++.jason/rfg10.C | 11 + gcc/testsuite/g++.old-deja/g++.jason/rfg11.C | 2 + gcc/testsuite/g++.old-deja/g++.jason/rfg12.C | 2 + gcc/testsuite/g++.old-deja/g++.jason/rfg13.C | 12 + gcc/testsuite/g++.old-deja/g++.jason/rfg14.C | 16 + gcc/testsuite/g++.old-deja/g++.jason/rfg16.C | 5 + gcc/testsuite/g++.old-deja/g++.jason/rfg17.C | 16 + gcc/testsuite/g++.old-deja/g++.jason/rfg18.C | 11 + gcc/testsuite/g++.old-deja/g++.jason/rfg2.C | 6 + gcc/testsuite/g++.old-deja/g++.jason/rfg20.C | 10 + gcc/testsuite/g++.old-deja/g++.jason/rfg21.C | 2 + gcc/testsuite/g++.old-deja/g++.jason/rfg22.C | 7 + gcc/testsuite/g++.old-deja/g++.jason/rfg23.C | 3 + gcc/testsuite/g++.old-deja/g++.jason/rfg24.C | 9 + gcc/testsuite/g++.old-deja/g++.jason/rfg25.C | 2 + gcc/testsuite/g++.old-deja/g++.jason/rfg26.C | 10 + gcc/testsuite/g++.old-deja/g++.jason/rfg27.C | 8 + gcc/testsuite/g++.old-deja/g++.jason/rfg28.C | 10 + gcc/testsuite/g++.old-deja/g++.jason/rfg3.C | 15 + gcc/testsuite/g++.old-deja/g++.jason/rfg4.C | 13 + gcc/testsuite/g++.old-deja/g++.jason/rfg5.C | 11 + gcc/testsuite/g++.old-deja/g++.jason/rfg6.C | 4 + gcc/testsuite/g++.old-deja/g++.jason/rfg7.C | 6 + gcc/testsuite/g++.old-deja/g++.jason/rfg8.C | 4 + gcc/testsuite/g++.old-deja/g++.jason/rfg9.C | 10 + gcc/testsuite/g++.old-deja/g++.jason/rvalue1.C | 52 ++ gcc/testsuite/g++.old-deja/g++.jason/rvalue2.C | 18 + gcc/testsuite/g++.old-deja/g++.jason/rvalue3.C | 6 + gcc/testsuite/g++.old-deja/g++.jason/scoping.C | 12 + gcc/testsuite/g++.old-deja/g++.jason/scoping10.C | 16 + gcc/testsuite/g++.old-deja/g++.jason/scoping11.C | 11 + gcc/testsuite/g++.old-deja/g++.jason/scoping12.C | 10 + gcc/testsuite/g++.old-deja/g++.jason/scoping13.C | 10 + gcc/testsuite/g++.old-deja/g++.jason/scoping14.C | 8 + gcc/testsuite/g++.old-deja/g++.jason/scoping15.C | 21 + gcc/testsuite/g++.old-deja/g++.jason/scoping16.C | 5 + gcc/testsuite/g++.old-deja/g++.jason/scoping17.C | 9 + gcc/testsuite/g++.old-deja/g++.jason/scoping2.C | 15 + gcc/testsuite/g++.old-deja/g++.jason/scoping3.C | 8 + gcc/testsuite/g++.old-deja/g++.jason/scoping4.C | 30 ++ gcc/testsuite/g++.old-deja/g++.jason/scoping5.C | 6 + gcc/testsuite/g++.old-deja/g++.jason/scoping6.C | 27 + gcc/testsuite/g++.old-deja/g++.jason/scoping7.C | 6 + gcc/testsuite/g++.old-deja/g++.jason/scoping8.C | 8 + gcc/testsuite/g++.old-deja/g++.jason/scoping9.C | 12 + gcc/testsuite/g++.old-deja/g++.jason/shadow1.C | 16 + gcc/testsuite/g++.old-deja/g++.jason/soverload.C | 10 + gcc/testsuite/g++.old-deja/g++.jason/special.C | 7 + gcc/testsuite/g++.old-deja/g++.jason/static1.C | 32 ++ gcc/testsuite/g++.old-deja/g++.jason/synth.C | 13 + gcc/testsuite/g++.old-deja/g++.jason/synth10.C | 52 ++ gcc/testsuite/g++.old-deja/g++.jason/synth2.C | 8 + gcc/testsuite/g++.old-deja/g++.jason/synth3.C | 6 + gcc/testsuite/g++.old-deja/g++.jason/synth4.C | 15 + gcc/testsuite/g++.old-deja/g++.jason/synth5.C | 15 + gcc/testsuite/g++.old-deja/g++.jason/synth6.C | 15 + gcc/testsuite/g++.old-deja/g++.jason/synth7.C | 12 + gcc/testsuite/g++.old-deja/g++.jason/synth8.C | 20 + gcc/testsuite/g++.old-deja/g++.jason/synth9.C | 20 + gcc/testsuite/g++.old-deja/g++.jason/tempargs.C | 8 + gcc/testsuite/g++.old-deja/g++.jason/tempcons.C | 8 + gcc/testsuite/g++.old-deja/g++.jason/tempdest.C | 20 + gcc/testsuite/g++.old-deja/g++.jason/tempinst1.C | 23 + gcc/testsuite/g++.old-deja/g++.jason/template1.C | 20 + gcc/testsuite/g++.old-deja/g++.jason/template10.C | 31 ++ gcc/testsuite/g++.old-deja/g++.jason/template11.C | 16 + gcc/testsuite/g++.old-deja/g++.jason/template12.C | 14 + gcc/testsuite/g++.old-deja/g++.jason/template14.C | 17 + gcc/testsuite/g++.old-deja/g++.jason/template15.C | 28 ++ gcc/testsuite/g++.old-deja/g++.jason/template16.C | 34 ++ gcc/testsuite/g++.old-deja/g++.jason/template17.C | 11 + gcc/testsuite/g++.old-deja/g++.jason/template19.C | 10 + gcc/testsuite/g++.old-deja/g++.jason/template2.C | 12 + gcc/testsuite/g++.old-deja/g++.jason/template20.C | 10 + gcc/testsuite/g++.old-deja/g++.jason/template21.C | 16 + gcc/testsuite/g++.old-deja/g++.jason/template22.C | 31 ++ gcc/testsuite/g++.old-deja/g++.jason/template23.C | 12 + gcc/testsuite/g++.old-deja/g++.jason/template24.C | 23 + gcc/testsuite/g++.old-deja/g++.jason/template25.C | 49 ++ gcc/testsuite/g++.old-deja/g++.jason/template26.C | 115 +++++ gcc/testsuite/g++.old-deja/g++.jason/template27.C | 49 ++ gcc/testsuite/g++.old-deja/g++.jason/template28.C | 34 ++ gcc/testsuite/g++.old-deja/g++.jason/template29.C | 19 + gcc/testsuite/g++.old-deja/g++.jason/template3.C | 15 + gcc/testsuite/g++.old-deja/g++.jason/template30.C | 15 + gcc/testsuite/g++.old-deja/g++.jason/template31.C | 40 ++ gcc/testsuite/g++.old-deja/g++.jason/template32.C | 10 + gcc/testsuite/g++.old-deja/g++.jason/template33.C | 17 + gcc/testsuite/g++.old-deja/g++.jason/template34.C | 25 + gcc/testsuite/g++.old-deja/g++.jason/template35.C | 15 + gcc/testsuite/g++.old-deja/g++.jason/template36.C | 57 +++ gcc/testsuite/g++.old-deja/g++.jason/template39.C | 22 + gcc/testsuite/g++.old-deja/g++.jason/template4.C | 21 + gcc/testsuite/g++.old-deja/g++.jason/template40.C | 20 + gcc/testsuite/g++.old-deja/g++.jason/template41.C | 34 ++ gcc/testsuite/g++.old-deja/g++.jason/template42.C | 19 + gcc/testsuite/g++.old-deja/g++.jason/template43.C | 31 ++ gcc/testsuite/g++.old-deja/g++.jason/template44.C | 62 +++ gcc/testsuite/g++.old-deja/g++.jason/template5.C | 28 ++ gcc/testsuite/g++.old-deja/g++.jason/template6.C | 21 + gcc/testsuite/g++.old-deja/g++.jason/template7.C | 9 + gcc/testsuite/g++.old-deja/g++.jason/template8.C | 10 + gcc/testsuite/g++.old-deja/g++.jason/template9.C | 12 + gcc/testsuite/g++.old-deja/g++.jason/temporary.C | 20 + gcc/testsuite/g++.old-deja/g++.jason/temporary2.C | 19 + gcc/testsuite/g++.old-deja/g++.jason/temporary3.C | 27 + gcc/testsuite/g++.old-deja/g++.jason/temporary4.C | 32 ++ gcc/testsuite/g++.old-deja/g++.jason/temporary5.C | 19 + gcc/testsuite/g++.old-deja/g++.jason/temporary6.C | 8 + gcc/testsuite/g++.old-deja/g++.jason/temporary7.C | 36 ++ gcc/testsuite/g++.old-deja/g++.jason/temporary8.C | 26 + gcc/testsuite/g++.old-deja/g++.jason/tempover.C | 14 + gcc/testsuite/g++.old-deja/g++.jason/tempparse.C | 29 ++ gcc/testsuite/g++.old-deja/g++.jason/tempsub.C | 28 ++ gcc/testsuite/g++.old-deja/g++.jason/this.C | 16 + gcc/testsuite/g++.old-deja/g++.jason/thunk1.C | 47 ++ gcc/testsuite/g++.old-deja/g++.jason/thunk2.C | 49 ++ gcc/testsuite/g++.old-deja/g++.jason/thunk3.C | 59 +++ gcc/testsuite/g++.old-deja/g++.jason/tredecl.C | 17 + gcc/testsuite/g++.old-deja/g++.jason/tredecl2.C | 5 + gcc/testsuite/g++.old-deja/g++.jason/tredecl3.C | 11 + gcc/testsuite/g++.old-deja/g++.jason/tredecl4.C | 6 + gcc/testsuite/g++.old-deja/g++.jason/trivial.C | 71 +++ gcc/testsuite/g++.old-deja/g++.jason/typeck.C | 19 + gcc/testsuite/g++.old-deja/g++.jason/typedef.C | 10 + gcc/testsuite/g++.old-deja/g++.jason/typedef2.C | 13 + gcc/testsuite/g++.old-deja/g++.jason/typedef3.C | 8 + gcc/testsuite/g++.old-deja/g++.jason/typeid1.C | 12 + gcc/testsuite/g++.old-deja/g++.jason/typeid2.C | 31 ++ gcc/testsuite/g++.old-deja/g++.jason/union.C | 11 + gcc/testsuite/g++.old-deja/g++.jason/vecdel.C | 20 + gcc/testsuite/g++.old-deja/g++.jason/virtual.C | 41 ++ gcc/testsuite/g++.old-deja/g++.jason/virtual2.C | 14 + gcc/testsuite/g++.old-deja/g++.jason/warning1.C | 7 + gcc/testsuite/g++.old-deja/g++.jason/warning10.C | 19 + gcc/testsuite/g++.old-deja/g++.jason/warning2.C | 14 + gcc/testsuite/g++.old-deja/g++.jason/warning3.C | 12 + gcc/testsuite/g++.old-deja/g++.jason/warning4.C | 16 + gcc/testsuite/g++.old-deja/g++.jason/warning5.C | 25 + gcc/testsuite/g++.old-deja/g++.jason/warning6.C | 7 + gcc/testsuite/g++.old-deja/g++.jason/warning7.C | 6 + gcc/testsuite/g++.old-deja/g++.jason/warning8.C | 17 + gcc/testsuite/g++.old-deja/g++.jason/warning9.C | 15 + 409 files changed, 8017 insertions(+) create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/2371.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/3523.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/access1.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/access10.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/access11.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/access12.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/access13.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/access14.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/access15.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/access16.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/access17.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/access18.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/access2.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/access20.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/access21.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/access22.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/access23.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/access24.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/access3.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/access4.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/access5.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/access6.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/access7.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/access8.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/access9.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/aggregate.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/ambig1.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/ambig2.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/ambig3.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/anon.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/anon2.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/anon3.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/anon4.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/binding.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/binding2.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/binding3.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/bool.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/bool2.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/bool3.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/bool4.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/bool5.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/bool6.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/bool7.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/builtin.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/builtin2.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/byval.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/byval2.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/byval3.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/c-inline.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/cast1.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/cast2.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/cast3.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/cleanup.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/cleanup2.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/complete1.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/cond.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/cond2.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/condexp.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/const.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/const2.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/const3.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/const4.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/context.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/conversion.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/conversion10.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/conversion11.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/conversion2.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/conversion3.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/conversion4.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/conversion5.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/conversion6.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/conversion7.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/conversion8.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/conversion9.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/crash1.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/crash10.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/crash11.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/crash12.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/crash3.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/crash4.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/crash5.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/crash6.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/crash7.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/crash8.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/crash9.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/ctor1.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/ctor2.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/dcast1.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/dcast2.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/dcast3.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/default1.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/default2.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/default3.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/defctor.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/delete1.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/delete2.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/delete3.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/destruct.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/destruct2.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/destruct3.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/destruct4.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/dot.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/dtor.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/dtor2.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/dtor3.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/dtor4.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/dtor5.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/enum.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/enum2.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/enum3.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/enum4.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/enum5.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/enum6.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/enum7.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/enum8.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/explicit.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/expr1.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/friend.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/friend2.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/groff1.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/hmc1.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/incomplete1.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/incomplete2.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/init.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/init2.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/init3.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/init4.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/inline.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/inline2.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/inline3.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/jump.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/lex1.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/lineno.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/lineno2.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/lineno3.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/lineno4.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/lineno5.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/local.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/lookup.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/lookup2.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/lookup3.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/loverload.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/loverload3.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/loverload4.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/lvalue.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/lvalue2.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/lvalue3.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/lvalue4.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/mangle1.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/mangle2.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/mangle3.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/member.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/method.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/mi.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/mutable1.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/nested1.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/nested2.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/nested4.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/nested5.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/nested6.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/nested7.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/nested8.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/net.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/net2.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/new.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/new2.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/new3.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/new4.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/new5.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/offset1.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/offset2.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/offset3.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/offset4.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/opeq.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/opeq2.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/opeq3.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/opeq4.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/opeq5.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/opeq6.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/operator.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/operator2.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/opover.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/optimize.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/optimize2.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/overload.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/overload1.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/overload11.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/overload12.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/overload13.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/overload14.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/overload15.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/overload16.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/overload17.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/overload18.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/overload19.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/overload2.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/overload20.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/overload21.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/overload22.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/overload23.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/overload24.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/overload26.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/overload27.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/overload28.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/overload29.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/overload3.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/overload30.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/overload31.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/overload32.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/overload33.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/overload34.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/overload35.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/overload36.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/overload4.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/overload5.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/overload6.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/overload7.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/overload8.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/overload9.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/parse1.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/parse10.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/parse11.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/parse12.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/parse13.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/parse14.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/parse2.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/parse3.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/parse4.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/parse5.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/parse6.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/parse7.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/parse8.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/parse9.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/pmem.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/pmem2.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/pmem3.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/pmem4.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/pmf.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/pmf2.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/pmf3.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/pmf4.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/pmf5.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/pmf6.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/pmf7.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/pmf8.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/pmf9.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/pmftemp.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/precedence.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/redecl1.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/ref1.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/ref10.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/ref11.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/ref12.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/ref2.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/ref3.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/ref4.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/ref5.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/ref6.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/ref7.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/ref8.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/ref9.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/report.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/return.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/return2.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/return3.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/rfg1.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/rfg10.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/rfg11.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/rfg12.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/rfg13.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/rfg14.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/rfg16.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/rfg17.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/rfg18.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/rfg2.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/rfg20.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/rfg21.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/rfg22.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/rfg23.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/rfg24.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/rfg25.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/rfg26.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/rfg27.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/rfg28.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/rfg3.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/rfg4.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/rfg5.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/rfg6.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/rfg7.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/rfg8.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/rfg9.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/rvalue1.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/rvalue2.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/rvalue3.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/scoping.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/scoping10.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/scoping11.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/scoping12.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/scoping13.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/scoping14.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/scoping15.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/scoping16.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/scoping17.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/scoping2.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/scoping3.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/scoping4.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/scoping5.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/scoping6.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/scoping7.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/scoping8.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/scoping9.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/shadow1.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/soverload.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/special.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/static1.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/synth.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/synth10.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/synth2.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/synth3.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/synth4.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/synth5.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/synth6.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/synth7.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/synth8.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/synth9.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/tempargs.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/tempcons.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/tempdest.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/tempinst1.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/template1.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/template10.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/template11.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/template12.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/template14.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/template15.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/template16.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/template17.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/template19.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/template2.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/template20.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/template21.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/template22.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/template23.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/template24.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/template25.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/template26.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/template27.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/template28.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/template29.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/template3.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/template30.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/template31.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/template32.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/template33.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/template34.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/template35.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/template36.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/template39.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/template4.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/template40.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/template41.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/template42.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/template43.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/template44.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/template5.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/template6.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/template7.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/template8.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/template9.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/temporary.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/temporary2.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/temporary3.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/temporary4.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/temporary5.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/temporary6.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/temporary7.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/temporary8.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/tempover.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/tempparse.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/tempsub.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/this.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/thunk1.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/thunk2.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/thunk3.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/tredecl.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/tredecl2.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/tredecl3.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/tredecl4.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/trivial.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/typeck.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/typedef.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/typedef2.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/typedef3.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/typeid1.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/typeid2.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/union.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/vecdel.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/virtual.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/virtual2.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/warning1.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/warning10.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/warning2.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/warning3.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/warning4.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/warning5.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/warning6.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/warning7.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/warning8.C create mode 100644 gcc/testsuite/g++.old-deja/g++.jason/warning9.C (limited to 'gcc/testsuite/g++.old-deja/g++.jason') diff --git a/gcc/testsuite/g++.old-deja/g++.jason/2371.C b/gcc/testsuite/g++.old-deja/g++.jason/2371.C new file mode 100644 index 000000000..c4263d6a4 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/2371.C @@ -0,0 +1,551 @@ +// { dg-do run } +// { dg-options "" } +# 1 "SetLS.cc" +// GROUPS passed templates nested-classes +// +// The SetLS template test +// +// Wendell Baker, Berkeley CAD Group, 1993 (wbaker@ic.Berkeley.EDU) +// + +#pragma implementation "ListS.h" +#pragma implementation "SetLS.h" + +#include +#include +using namespace std; + +# 1 "../../templates/SetLS.h" 1 +// -*- C++ -*- + + + +// +// A Set Template - implemented with an ListS +// +// Wendell Baker, Berkeley CAD Group, 1993 (wbaker@ic.Berkeley.EDU) +// + + + + + +#pragma interface + + + + + +#define XTRUE true +#define XFALSE false + +# 37 "../../templates/SetLS.h" + + +# 1 "../../templates/ListS.h" 1 +// -*- C++ -*- + + + +// +// A List Template - providing a singly linked capability +// +// Wendell Baker, Berkeley CAD Group, 1993 (wbaker@ic.Berkeley.EDU) +// + + + + + +#pragma interface + + + + + + +# 1 "/projects/gnu-cygnus/gnu-cygnus-14/mips/lib/gcc-lib/decstation/cygnus-reno-1/g++-include/bool.h" 1 3 +// Defining XTRUE and XFALSE is usually a Bad Idea, +// because you will probably be inconsistent with anyone +// else who had the same clever idea. +// Therefore: DON'T USE THIS FILE. + + + + + + + + + +# 23 "../../templates/ListS.h" 2 + +# 37 "../../templates/ListS.h" + + + +// g++ reno-1 is not yet capable of creating templates with nested +// classes which instantiate the template arguments. +template +struct ListS_link { + T item; + ListS_link *next; + + ListS_link(const T& i, ListS_link *n = 0): item(i), next(n) + { } +}; + + +// +// For now, errors are raised by ::abort() because exceptions +// are not well implemented in cxx or at all in CC 3.0.1 +// +template +class ListS { +public: + ListS(); + ListS(const ListS&); + ~ListS(); + + void operator=(const ListS&); + + unsigned length() const + { return count; } + + void prepend(const T& item); + void append(const T& item); + void clear(); + + const T& head() const + { ensure_1(); + return head_link->item; } + T& head() + { ensure_1(); + return head_link->item; } + void head(T& fill) const + { ensure_1(); + fill = head_link->item; } + void remove_head() + { remove_head_filling(0); } + void remove_head(T& fill) + { remove_head_filling(&fill); } + + const T& tail() const + { ensure_1(); + return tail_link->item; } + T& tail() + { ensure_1(); + return tail_link->item; } + void tail(T& fill) const + { ensure_1(); + fill = tail_link->item; } + + class Vix { + public: + Vix(): owner(0), index(0) + { } + + // These are friend functions so that v == x is the same as x == v + friend int operator==(void *v, const Vix& x) + { return v == x.index; } + friend int operator==(const Vix& x, void *v) + { return v == x.index; } + friend int operator!=(void *v, const Vix& x) + { return v != x.index; } + friend int operator!=(const Vix& x, void *v) + { return v != x.index; } + friend int operator==(const Vix& x1, const Vix& x2) + { return x1.owner == x2.owner && x1.index == x2.index; } + friend int operator!=(const Vix& x1, const Vix& x2) + { return x1.owner != x2.owner || x1.index != x2.index; } + private: + friend class ListS; + + + Vix(const ListS *o, ListS_link *i): owner(o), index(i) + { } + + + + + + const ListS *owner; + + ListS_link *index; + + + + }; + + Vix first() const + { return Vix(this, head_link); } + void next(Vix& x) const + { check(x); + if (x.index != 0) + x.index = x.index->next; } + T& operator()(const Vix& x) + { check(x); + return x.index->item; } + const T& operator()(const Vix& x) const + { check(x); + return x.index->item; } +protected: +# 154 "../../templates/ListS.h" + + + unsigned count; + + ListS_link *head_link; // 0 for a zero-length list + ListS_link *tail_link; // 0 for a zero-length list + + + + + +private: + // fill may be 0 (then don't fill) + void remove_head_filling(T *fill); + + void ensure_1() const + { if (0 == head_link) + ::abort(); } + void check(const Vix& x) const + { if (this != x.owner) + ::abort(); + if (0 == x.index) + ::abort(); } +}; + +template +ListS::ListS(): +count(0), +head_link(0), +tail_link(0) +{ } + +template +ListS::ListS(const ListS& other): +count(0), +head_link(0), +tail_link(0) +{ + for (Vix x=other.first(); 0 != x; other.next(x)) + append(other(x)); +} + +template +ListS::~ListS() +{ + clear(); +} + +template +void +ListS::operator=(const ListS& other) +{ + clear(); + for (Vix x=other.first(); 0 != x; other.next(x)) + append(other(x)); +} + +template +void +ListS::prepend(const T& item) +{ + + head_link = new ListS_link(item, head_link); + + + + if (0 == tail_link) + tail_link = head_link; + count++; +} + +template +void +ListS::append(const T& item) +{ + + ListS_link *new_link = new ListS_link(item); + + + + if (0 == tail_link) { + head_link = new_link; + tail_link = new_link; + } else { + tail_link->next = new_link; + tail_link = tail_link->next; + } + count++; +} + +template +void +ListS::clear() +{ + + ListS_link *next, *l; + + + + for (l=head_link; 0 != l; l=next) { + next = l->next; + delete l; + } + + count = 0; + head_link = 0; + tail_link = 0; +} + +template +void +ListS::remove_head_filling(T* fill) +// fill may be 0 in which case don't assign into it +{ + ensure_1(); + + ListS_link *ohead = head_link; + + + + if (0 != fill) + *fill = ohead->item; + head_link = ohead->next; + if (0 == head_link) + tail_link = 0; + count--; + delete ohead; +} + + +# 40 "../../templates/SetLS.h" 2 + + +# 62 "../../templates/SetLS.h" + +template +class SetLS { +public: + SetLS(); + + void add(const T& item); + // There is no remove(const T& item) for this set + bool contains(const T& item) const; + + unsigned length() const + { return list.length(); } + + void clear() + { list.clear(); } + + class Vix { + public: + Vix(): owner(0), vix() + { } + + // These are friend functions so that v == x is the same as x == v + friend int operator==(void *v, const Vix& x) + { return v == x.vix; } + friend int operator==(const Vix& x, void *v) + { return v == x.vix; } + friend int operator!=(void *v, const Vix& x) + { return v != x.vix; } + friend int operator!=(const Vix& x, void *v) + { return v != x.vix; } + friend int operator==(const Vix& x1, const Vix& x2) + { return x1.owner == x2.owner && x1.vix == x2.vix; } + friend int operator!=(const Vix& x1, const Vix& x2) + { return x1.owner != x2.owner || x1.vix != x2.vix; } + private: + friend class SetLS; + + Vix(const SetLS *o, const typename ListS::Vix& x): owner(o), vix(x) + { } + + const SetLS *owner; + typename ListS::Vix vix; + }; + friend class Vix; + + Vix first() const + { return Vix(this, list.first()); } + void next(Vix& x) const + { check(x); + list.next(x.vix); } + const T& operator()(const Vix& x) const + { check(x); + return list(x.vix); } + // There is item no remove(const Vix&) for this set +protected: + ListS list; + +private: + void check(const Vix& x) const + { if (this != x.owner) + ::abort(); } +}; + + +template +SetLS::SetLS(): + + + +list() + +{ } + +template +void +SetLS::add(const T& item) +{ + if ( ! contains(item) ) { + + + + list.append(item); + + } +} + +template +bool +SetLS::contains(const T& item) const +{ + for (Vix x=first(); 0 != x; next(x)) { + if (operator()(x) == item) + return XTRUE; + } + return XFALSE; +} + + +# 17 "SetLS.cc" 2 + + + +// In (most versions of) g++ 2.X, this use of typedefs has the effect +// of causing the instantiation of the templates, thereby testing the +// templates + +class test { +public: + test(): value(0) + { } + test(int v): value(v) + { } + + void print(ostream& out) const + { out << value; } + + friend int operator==(const test& a, const test& b); +private: + int value; +}; + +int +operator==(const test& a, const test& b) +{ + return a.value == b.value; +} + +ostream& +operator<<(ostream& o, const test& t) +{ + t.print(o); + return o; +} + +typedef SetLS SLS; + +static ostream& +operator<<(ostream& o, const SLS& s) +{ + o << "set of " << s.length() << " = {"; + + bool first; + SetLS::Vix x; + for (first=XTRUE, x=s.first(); 0 != x; s.next(x), first=XFALSE) { + if ( ! first ) + o << ','; + o << ' '; + s(x).print(o); + } + o << '}'; + + return o; +} + +SLS gsls; +const SLS gcsls; + +void foo() +{ + const unsigned SIZE = 20; + + // + // SetLS() + // SetLS(const SetLS&) + // + SLS sls; + { + // Fill sls with some interesting values + for (unsigned i=0; i&); + // + sls = csls; + + // + // bool contains(const T& item) const + // + for (unsigned i=0; i::Vix cx; + for (cx=csls.first(); 0 != cx; sls.next(cx)) { + if ( ! sls.contains(csls(cx)) ) + ::abort(); + } + + cout << "gsls:\t" << gsls << '\n'; + cout << "gcsls:\t" << gcsls << '\n'; + cout << "sls:\t" << sls << '\n'; + cout << "csls:\t" << csls << '\n'; +} + +// Dummy function so it'll run +int main() +{ + cout << "PASS" << endl; +} + +template class ListS; diff --git a/gcc/testsuite/g++.old-deja/g++.jason/3523.C b/gcc/testsuite/g++.old-deja/g++.jason/3523.C new file mode 100644 index 000000000..a0ddc9ca1 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/3523.C @@ -0,0 +1,40 @@ +// { dg-do assemble } +// GROUPS passed assignment +class ccUnwind +{ +public: + virtual ~ccUnwind (); // comment out virtual, and void diag changes +}; + +template +class ccHandle : public ccUnwind // similarly comment out inheritance +{ +public: + ccHandle& operator = (const ccHandle& h); +}; + +class cc_Image; + +class ccImage : public ccHandle +{ +public: +// reversing the order of the next two lines changes the diagnostic +// printed about the def of ccDisplay::image + ccImage (const ccImage &); + ccImage (const cc_Image &); +}; + +class ccDisplay +{ +public: + ccImage img; +//ccImage image ( ccImage i) {img = i; return img;} +// above line compiles + ccImage image ( ccImage i) { return img = i;} /* this gets void* error */ +}; + + + +// vd.C: In method `class ccImage ccDisplay::image (class ccImage)': +// vd.C:31: bad argument 1 for function `ccImage::ccImage (const class cc_Image&)' (type was void *) +// vd.C:31: in base initialization for class `ccImage' diff --git a/gcc/testsuite/g++.old-deja/g++.jason/access1.C b/gcc/testsuite/g++.old-deja/g++.jason/access1.C new file mode 100644 index 000000000..9d7104105 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/access1.C @@ -0,0 +1,17 @@ +// { dg-do assemble } +// Bug: access declarations are broken. + +class A { +public: + void foo (); +}; + +class B: private A { +public: + A::foo; +}; + +void foo() { + B b; + b.foo (); // { dg-bogus "" } +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/access10.C b/gcc/testsuite/g++.old-deja/g++.jason/access10.C new file mode 100644 index 000000000..a8a2bb9fd --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/access10.C @@ -0,0 +1,14 @@ +// { dg-do assemble } +// PRMS Id: 4839 +// Bug: The initializer of a static member of a class has the same acess +// rights as a member function. g++ doesn't realize that. + +class X +{ + X (int); + static X foo; +public: + void dummy(); +}; + +X X::foo = 9; diff --git a/gcc/testsuite/g++.old-deja/g++.jason/access11.C b/gcc/testsuite/g++.old-deja/g++.jason/access11.C new file mode 100644 index 000000000..dd30e26fa --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/access11.C @@ -0,0 +1,12 @@ +// { dg-do assemble } +// PRMS Id: 4900 +// Bug: g++ doesn't apply access control uniformly to type conversion operators + +struct A { +protected: + operator int * () const; +}; + +struct B : public A { + int * foo () { return A::operator int *(); } +}; diff --git a/gcc/testsuite/g++.old-deja/g++.jason/access12.C b/gcc/testsuite/g++.old-deja/g++.jason/access12.C new file mode 100644 index 000000000..a230069c4 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/access12.C @@ -0,0 +1,16 @@ +// { dg-do assemble } +// PRMS Id: 4694 +// Bug: g++ doesn't realize that A::i refers to a member of `this' in B(). + +class A { +protected: + int i; +}; + +struct B : public A { + B () { A::i = 0; } +}; + +struct C : public B { + C () { B::i = 0; } +}; diff --git a/gcc/testsuite/g++.old-deja/g++.jason/access13.C b/gcc/testsuite/g++.old-deja/g++.jason/access13.C new file mode 100644 index 000000000..a891aeaad --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/access13.C @@ -0,0 +1,15 @@ +// { dg-do assemble } +// PRMS Id: 4955 + +struct A { + protected: + int i; + void f (); +}; + +struct B: public A { + void g () { + this->A::i = 1; // { dg-bogus "" } access control failure + this->A::f(); // { dg-bogus "" } access control failure + } +}; diff --git a/gcc/testsuite/g++.old-deja/g++.jason/access14.C b/gcc/testsuite/g++.old-deja/g++.jason/access14.C new file mode 100644 index 000000000..baebfe4cf --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/access14.C @@ -0,0 +1,10 @@ +// { dg-do assemble } + +template struct A { T t; }; + +template class B: private T { + public: + T::t; // { dg-bogus "" } doesn't recognize access decl +}; + +template class B >; diff --git a/gcc/testsuite/g++.old-deja/g++.jason/access15.C b/gcc/testsuite/g++.old-deja/g++.jason/access15.C new file mode 100644 index 000000000..d7a30f9ff --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/access15.C @@ -0,0 +1,18 @@ +// { dg-do assemble } +// Bug: g++ complains about Z being a private base when trying to +// initialize B::foo. + +struct Z { + Z(); + Z(int); +}; + +struct A : private Z { }; +struct B : public A +{ + ::Z foo; + B(); + B(const B&); +}; + +B::B() : foo(1) { } // { dg-bogus "" } diff --git a/gcc/testsuite/g++.old-deja/g++.jason/access16.C b/gcc/testsuite/g++.old-deja/g++.jason/access16.C new file mode 100644 index 000000000..4eb499b63 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/access16.C @@ -0,0 +1,20 @@ +// { dg-do assemble } +// Bug: g++ uses the same binfo for the a subobject of c and the a subobject +// of b, so basetype_paths get bashed improperly. + +class a { +protected: + virtual void foo() { } // { dg-bogus "" } +}; + +class b : public virtual a {}; + +class c : public b { +public: + void bar() { b::foo(); } // { dg-bogus "" } +}; + +int main() { + c test; + test.bar(); +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/access17.C b/gcc/testsuite/g++.old-deja/g++.jason/access17.C new file mode 100644 index 000000000..ec8949d77 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/access17.C @@ -0,0 +1,24 @@ +// { dg-do assemble } +// Make sure definitions of static members have the right access. + +struct A { +protected: + int i; // { dg-error "" } private + int f (); // { dg-error "" } +}; + +struct B: public A { + static int A::*p; + static int (A::*fp)(); +}; + +int A::* B::p = &A::i; // { dg-error "" } +int (A::* B::fp)() = &A::f; // { dg-error "" } + +struct C { + static int A::*p; + static int (A::*fp)(); +}; + +int A::* C::p = &A::i; // { dg-error "" } +int (A::* C::fp)() = &A::f; // { dg-error "" } diff --git a/gcc/testsuite/g++.old-deja/g++.jason/access18.C b/gcc/testsuite/g++.old-deja/g++.jason/access18.C new file mode 100644 index 000000000..900058cab --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/access18.C @@ -0,0 +1,24 @@ +// { dg-do assemble } +// { dg-options "-w" } +// PRMS Id: 5073 +// Bug: g++ doesn't catch access violations in base initializers. + +int r = 0; +class A { + private: + A() { r = 1; } // { dg-error "" } + ~A() {} // { dg-error "" } +}; + +class B : public A { + public: + B(): A() {} // { dg-error "" } + B(const B&) {} // { dg-error "" } + ~B() { } // { dg-error "" } private dtor +}; + +main() +{ + B b; + return r; +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/access2.C b/gcc/testsuite/g++.old-deja/g++.jason/access2.C new file mode 100644 index 000000000..ee5c0eae0 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/access2.C @@ -0,0 +1,11 @@ +// { dg-do assemble } +// Bug: g++ doesn't deal with friends also being derived classes. + +class A { + int i; + friend class B; +}; + +class B : public A { + void f () { i = 1; } +}; diff --git a/gcc/testsuite/g++.old-deja/g++.jason/access20.C b/gcc/testsuite/g++.old-deja/g++.jason/access20.C new file mode 100644 index 000000000..71ca1375f --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/access20.C @@ -0,0 +1,39 @@ +// { dg-do assemble } +// PRMS Id: 6662 +// Bug: we crash trying to check the access on anglesSinesCosines. + +#define Double double + +class GCTransform +{ + protected: + struct angle + { + Double phi1 ; + Double phi2 ; + } ; + + struct sineAndCosine + { + Double cosine1 ; + Double cosine2 ; + Double sine1 ; + Double sine2 ; + } ; + + union anglesSinesCosines + { + struct angle a ; + struct sineAndCosine siCo ; + } ; +}; + +class GCTransTransmit : public GCTransform +{ + protected: + + struct GCTransTransmitDataTemp + { + union anglesSinesCosines t ; // causes abort + } ; +} ; diff --git a/gcc/testsuite/g++.old-deja/g++.jason/access21.C b/gcc/testsuite/g++.old-deja/g++.jason/access21.C new file mode 100644 index 000000000..7d876fce9 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/access21.C @@ -0,0 +1,22 @@ +// { dg-do assemble } +// PRMS Id: 6877 + +typedef __SIZE_TYPE__ size_t; +class aa { +public: + aa(); + ~aa(); +private: + int iaa; + void operator delete(void*, size_t); +}; + +class bb { +public: + aa caa; +}; // { dg-bogus "" } calling private delete + +void +f(){ + bb abb; +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/access22.C b/gcc/testsuite/g++.old-deja/g++.jason/access22.C new file mode 100644 index 000000000..efd09e52c --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/access22.C @@ -0,0 +1,22 @@ +// { dg-do assemble } +// PRMS Id: 8518 +// Bug: Call to foo is not checked for accessibility + +class A +{ + private: + static void foo() {} // { dg-error "" } + public: + void goo() {} +}; + +struct B : public A +{ + void func() { foo(); } // { dg-error "" } +}; + +int main() +{ + B b; + b.func(); +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/access23.C b/gcc/testsuite/g++.old-deja/g++.jason/access23.C new file mode 100644 index 000000000..ff2c8e8bc --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/access23.C @@ -0,0 +1,80 @@ +// { dg-do assemble } +// PRMS Id: 9127 +// Bug: members of anonymous unions are not access-controlled. + +#include + +struct Foo { +public: + union { + long A; + void *pX; + }; + union X { + long A; + void *pX; + } PUB ; + int PUB_A; +protected: + union { + long B; // { dg-error "" } protected + void *pY; // { dg-error "" } protected + } ; + union Y { + long B; + void *pY; + } PRT; // { dg-error "" } protected + int PRT_A; // { dg-error "" } protected +private: + union { + long C; // { dg-error "" } private + void *pZ; // { dg-error "" } private + }; + union Z { + long C; + void *pZ; + } PRV; // { dg-error "" } private + int PRV_A; // { dg-error "" } private +}; + +struct Bar : public Foo { +public: + void 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; // { dg-error "" } + Foo::C = 0; // { dg-error "" } + printf("%x\n",pZ); // { dg-error "" } + Foo::PRV.C = 0; // { dg-error "" } + printf("%x\n",PRV.pZ); // { dg-error "" } + } +}; + +int main() +{ + Foo a; + + a.PUB_A = 0; + a.A = 0; + printf("%x\n",a.pX); + a.PRT_A = 0; // { dg-error "" } + a.B = 0; // { dg-error "" } + printf("%x\n",a.pY); // { dg-error "" } + a.PRV_A = 0; // { dg-error "" } + a.C = 0; // { dg-error "" } + printf("%x\n",a.pZ); // { dg-error "" } + a.PUB.A = 0; + printf("%x\n",a.PUB.pX); + a.PRT.B = 0; // { dg-error "" } + printf("%x\n",a.PRT.pY); // { dg-error "" } + a.PRV.C = 0; // { dg-error "" } + printf("%x\n",a.PRV.pZ); // { dg-error "" } +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/access24.C b/gcc/testsuite/g++.old-deja/g++.jason/access24.C new file mode 100644 index 000000000..e633766ac --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/access24.C @@ -0,0 +1,11 @@ +// { dg-do assemble } +// Bug: forward reference to friend doesn't work in template. + +template class A { + static int i; + friend struct B; +}; + +struct B { + void f () { A::i = 0; } +}; diff --git a/gcc/testsuite/g++.old-deja/g++.jason/access3.C b/gcc/testsuite/g++.old-deja/g++.jason/access3.C new file mode 100644 index 000000000..c4e1b1880 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/access3.C @@ -0,0 +1,12 @@ +// { dg-do assemble } +// Simple testcase for access control. + +class A { + protected: + void f (); +}; + +class B : public A { + public: + void f () { A::f(); } +}; diff --git a/gcc/testsuite/g++.old-deja/g++.jason/access4.C b/gcc/testsuite/g++.old-deja/g++.jason/access4.C new file mode 100644 index 000000000..fd4eb3719 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/access4.C @@ -0,0 +1,14 @@ +// { dg-do assemble } +// Simple testcase for access control. + +class A { +protected: + static int i; +}; + +class B: public A { }; + +class C: public B { +public: + void g () { B b; b.i; } +}; diff --git a/gcc/testsuite/g++.old-deja/g++.jason/access5.C b/gcc/testsuite/g++.old-deja/g++.jason/access5.C new file mode 100644 index 000000000..03e7d7a45 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/access5.C @@ -0,0 +1,12 @@ +// { dg-do assemble } +// Simple testcase for access control. + +class A { + protected: + void f (); +}; + +class B : public A { }; +class C : public B { + void f () { B::f(); } +}; diff --git a/gcc/testsuite/g++.old-deja/g++.jason/access6.C b/gcc/testsuite/g++.old-deja/g++.jason/access6.C new file mode 100644 index 000000000..f75a44d2d --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/access6.C @@ -0,0 +1,12 @@ +// { dg-do assemble } +// Simple testcase for access control. + +class A { + public: + void f (); +}; + +class B: protected A { }; +class C: protected B { + void g() { f (); } +}; diff --git a/gcc/testsuite/g++.old-deja/g++.jason/access7.C b/gcc/testsuite/g++.old-deja/g++.jason/access7.C new file mode 100644 index 000000000..edb4bc978 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/access7.C @@ -0,0 +1,13 @@ +// { dg-do assemble } +// Simple testcase for access control. + +class A { + protected: + static void f (); +}; + +class B: public A {}; +class C: public A {}; +class D: public C, public B { + void g () { A::f(); } // { dg-bogus "" } wrongly ambiguous static member call +}; diff --git a/gcc/testsuite/g++.old-deja/g++.jason/access8.C b/gcc/testsuite/g++.old-deja/g++.jason/access8.C new file mode 100644 index 000000000..0297c106b --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/access8.C @@ -0,0 +1,30 @@ +// { dg-do assemble } +// From: smidt@dd.chalmers.se (Peter Smidt) +// Date: 25 Jan 1994 23:41:33 -0500 +// Bug: g++ forgets access decls after the definition. + +class inh { // { dg-error "" } inaccessible + int a; +protected: + void myf(int); +}; + +class mel : private inh { +protected: + int t; + inh::myf; +}; + +class top_t : protected mel { +public: + void myf(int); +}; + +void inh::myf(int i) { + a = i; +} + +void top_t::myf(int i) { + inh::myf(i); // { dg-error "" } cannot convert to inh + mel::myf(i); +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/access9.C b/gcc/testsuite/g++.old-deja/g++.jason/access9.C new file mode 100644 index 000000000..6cc1440bf --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/access9.C @@ -0,0 +1,9 @@ +// { dg-do assemble } +// Bug: g++ doesn't allow const objects to be constructed. + +struct B { B(); }; + +const B foo() +{ + return B(); // { dg-bogus "" } constructing const +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/aggregate.C b/gcc/testsuite/g++.old-deja/g++.jason/aggregate.C new file mode 100644 index 000000000..f739e56d0 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/aggregate.C @@ -0,0 +1,14 @@ +// { dg-do run } +struct A { int i; }; + +int 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; +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/ambig1.C b/gcc/testsuite/g++.old-deja/g++.jason/ambig1.C new file mode 100644 index 000000000..9be10eb3a --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/ambig1.C @@ -0,0 +1,7 @@ +// { dg-do assemble } +// { dg-options "-pedantic-errors" } +// Testcase for ambiguity between functional cast and abstract declarator. +// This ambiguity accounts for 6 of the r/r conflicts. + +int i = sizeof (int ()); // { dg-error "" } sizeof applied to fn type +int j = sizeof (int () + 1); diff --git a/gcc/testsuite/g++.old-deja/g++.jason/ambig2.C b/gcc/testsuite/g++.old-deja/g++.jason/ambig2.C new file mode 100644 index 000000000..1a6f67f25 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/ambig2.C @@ -0,0 +1,11 @@ +// { dg-do assemble } +// { dg-options "-Wno-pointer-arith" } +// Testcase for ambiguity between cast and parmlist. +// This ambiguity accounts for 1 of the r/r conflicts. +// Do not compile with -pedantic so that the compiler will accept taking +// the sizeof a function type. + +void f(){ + (void)sizeof(int((int)1.2)); + (void)sizeof(int((int))); // { dg-bogus "" } +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/ambig3.C b/gcc/testsuite/g++.old-deja/g++.jason/ambig3.C new file mode 100644 index 000000000..08cf2b7dc --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/ambig3.C @@ -0,0 +1,16 @@ +// { dg-do assemble } +// Testcase for ambiguity between function and variable declaration (8.2). + +struct A { + A (int, int); + int k; +}; + +void f () +{ + int i[2], j; + A a (int (i[1]), j); // { dg-bogus "" } late parsing + A b (int (i[1]), int j); // function + a.k = 0; // { dg-bogus "" } late parsing + b (i, j); +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/anon.C b/gcc/testsuite/g++.old-deja/g++.jason/anon.C new file mode 100644 index 000000000..e970359f8 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/anon.C @@ -0,0 +1,19 @@ +// { dg-do run } +// Bug: g++ has trouble copying anonymous structs. + +typedef struct { int i; } foo; +struct A : public foo { + struct { int i; } x; +}; + +int main () +{ + A a; + a.i = 5; + a.x.i = 42; + A b (a); + a = b; + if (a.i != 5 || a.x.i != 42) + return 1; + return 0; +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/anon2.C b/gcc/testsuite/g++.old-deja/g++.jason/anon2.C new file mode 100644 index 000000000..2aba55649 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/anon2.C @@ -0,0 +1,7 @@ +// { dg-do assemble } +// g++ should not complain about anonymous bitfields. + +struct A +{ + int : 2; +}; diff --git a/gcc/testsuite/g++.old-deja/g++.jason/anon3.C b/gcc/testsuite/g++.old-deja/g++.jason/anon3.C new file mode 100644 index 000000000..d2964f5aa --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/anon3.C @@ -0,0 +1,25 @@ +// { dg-do assemble } +// Bug: g++ dies. + +class cl { +public: + cl(); + void set(void *, char *, int); +private: + union { + float vf; + struct ff { // { dg-error "" } nested class in anonymous union + void *ptr; + char *name; + int sz; + } *vff; + }; +}; + +void cl::set(void *p, char *n, int sz) +{ + vff = new ff; // This procude an internal compiler error. + vff->ptr = p; + vff->name = n; + vff->sz = sz; +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/anon4.C b/gcc/testsuite/g++.old-deja/g++.jason/anon4.C new file mode 100644 index 000000000..588bf263c --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/anon4.C @@ -0,0 +1,14 @@ +// { dg-do assemble } +// { dg-options "-O" } +// PRMS Id: 5371 +// Bug: g++ screws up the alignment of buff and dies. + +main() +{ + union { + double a; + char buff[sizeof(double)]; + }; + + void *p = buff; +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/binding.C b/gcc/testsuite/g++.old-deja/g++.jason/binding.C new file mode 100644 index 000000000..1f297b76d --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/binding.C @@ -0,0 +1,12 @@ +// { dg-do assemble } +// Bug: g++ only looks in the current temporary binding level for a name. + +struct T { ~T(); }; + +int main() +{ + foo: + T t; // { dg-error "" } redeclared + bar: + T t; // { dg-error "" } redeclaration +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/binding2.C b/gcc/testsuite/g++.old-deja/g++.jason/binding2.C new file mode 100644 index 000000000..5a7328125 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/binding2.C @@ -0,0 +1,15 @@ +// { dg-do assemble } +// Bug: g++ screws up binding levels in a switch statement with cleanups. + +struct A { + ~A() { } +}; + +int f (int i) +{ + switch (i) { + default: + A a; + } + return 1; +} // causes compiler segfault diff --git a/gcc/testsuite/g++.old-deja/g++.jason/binding3.C b/gcc/testsuite/g++.old-deja/g++.jason/binding3.C new file mode 100644 index 000000000..5ed4bd18c --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/binding3.C @@ -0,0 +1,20 @@ +// { dg-do assemble } +// Bug: g++ fails to clear out the IDENTIFIER_CLASS_VALUEs of various names +// after a class definition. + +struct A { + typedef double T; + virtual T f () = 0; +}; + +class B { + B (const B&); + void operator=(const B&); +public: + B (); + typedef void * T; +}; + +struct C : public A { + T f (); // { dg-bogus "" } +}; diff --git a/gcc/testsuite/g++.old-deja/g++.jason/bool.C b/gcc/testsuite/g++.old-deja/g++.jason/bool.C new file mode 100644 index 000000000..5e897bc54 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/bool.C @@ -0,0 +1,46 @@ +// { dg-do assemble } +// Testcase for uses of bool. + +int i,j,k; + +/* Check that types of certain expressions are bool. */ +void f () +{ + i ? j == k : true; + i ? j < k : true; + i ? j && k : true; +} + +/* Check that g++ can find a conversion to bool when one exists. */ +struct A { operator char * (); } a; +struct B { operator int (); } b; +struct C { operator float (); } c; +struct D { operator bool (); } d; +struct E { operator int E::* (); } e; + +void g () +{ + a || true; + b || true; + c || true; // { dg-bogus "" } + d || true; + e || true; +} + +/* Check for support in templates. */ +template struct F { }; +template class F; + +template void f (T, bool) { } +template void f (bool, bool); + +/* Special cases. */ +void h () +{ + /* Used to cause infinite recursion. */ + i&1 || true; + /* Should find conversion path to int. */ + d == true; +} + +bool boo = -1; diff --git a/gcc/testsuite/g++.old-deja/g++.jason/bool2.C b/gcc/testsuite/g++.old-deja/g++.jason/bool2.C new file mode 100644 index 000000000..e77bd8487 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/bool2.C @@ -0,0 +1,15 @@ +// { dg-do run } +// Make sure that bool bitfields promote to int properly. + +struct F { + bool b1 : 1; + bool b2 : 7; +}; + +int main() +{ + F f = { true, true }; + + if (int (f.b1) != 1) + return 1; +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/bool3.C b/gcc/testsuite/g++.old-deja/g++.jason/bool3.C new file mode 100644 index 000000000..4e31003ce --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/bool3.C @@ -0,0 +1,13 @@ +// { dg-do assemble } +// From: panisset@cae.ca (Jean-Francois Panisset) +// Subject: Problem with constant expressions for bitfields +// Date: Mon, 6 Jun 94 14:00:01 EDT + +// Bug: g++ doesn't treat boolean true and false as constant values. + +enum E { e1,e2,e3,e4,e5 }; + +struct X +{ + unsigned int bits : ((e5 > 4) ? 8 : 4); // { dg-bogus "" } constant expression +}; diff --git a/gcc/testsuite/g++.old-deja/g++.jason/bool4.C b/gcc/testsuite/g++.old-deja/g++.jason/bool4.C new file mode 100644 index 000000000..03b670c39 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/bool4.C @@ -0,0 +1,11 @@ +// { dg-do run } +// Test for allowing conversion to bool. + +struct A { }; + +int main () +{ + bool b = (void*)0; + b = (int A::*)0; + b = (int (A::*)())0; +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/bool5.C b/gcc/testsuite/g++.old-deja/g++.jason/bool5.C new file mode 100644 index 000000000..1d2f5b60b --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/bool5.C @@ -0,0 +1,11 @@ +// { dg-do run } +int main () +{ + bool b = false; + int i = b++; + if (i != false || b != true) + return 1; + i = b++; + if (i != true || b != true) + return 1; +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/bool6.C b/gcc/testsuite/g++.old-deja/g++.jason/bool6.C new file mode 100644 index 000000000..30d046961 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/bool6.C @@ -0,0 +1,9 @@ +// { dg-do assemble } +// Bug: The conversion from bool to int gets stripped. + +bool b; + +int main () +{ + return ((!b) != 0); +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/bool7.C b/gcc/testsuite/g++.old-deja/g++.jason/bool7.C new file mode 100644 index 000000000..dd1a6f2a4 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/bool7.C @@ -0,0 +1,29 @@ +// { dg-do assemble } + +struct A +{ + operator bool () const; + operator const void * () const; +}; + +struct B +{ + A a; + int foo1 (); + int foo2 (); +}; + +int +B::foo1 () +{ + return a ? 0 : 1; // ambiguous default type conversion for `operator !=' +} + +int +B::foo2 () +{ + if (a) + return 0; + else + return 1; +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/builtin.C b/gcc/testsuite/g++.old-deja/g++.jason/builtin.C new file mode 100644 index 000000000..e310165c6 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/builtin.C @@ -0,0 +1,10 @@ +// { dg-do assemble } +// { dg-options "-w" } +// Bug: g++ overloads strlen instead of bashing the builtin version. + +extern "C" void strlen (const char *); + +void f () +{ + strlen("Hi"); +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/builtin2.C b/gcc/testsuite/g++.old-deja/g++.jason/builtin2.C new file mode 100644 index 000000000..16e4f4aa8 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/builtin2.C @@ -0,0 +1,8 @@ +// { dg-do assemble } + +static inline void strlen (const char *) { } + +void f () +{ + strlen("Hi"); // { dg-bogus "" } wrongful overload +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/byval.C b/gcc/testsuite/g++.old-deja/g++.jason/byval.C new file mode 100644 index 000000000..e09c6ea66 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/byval.C @@ -0,0 +1,20 @@ +// { dg-do run } +// 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) +{ } + +int main() +{ + foo (1); + return count; +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/byval2.C b/gcc/testsuite/g++.old-deja/g++.jason/byval2.C new file mode 100644 index 000000000..40bf2a365 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/byval2.C @@ -0,0 +1,23 @@ +// { dg-do assemble } +// From: panisset@cae.ca (Jean-Francois Panisset) +// Subject: 2.6.0 pre-rel, internal error, regression, mips-sgi-irix4 +// Date: Thu, 14 Jul 94 23:34:21 EDT + +class Char +{ +protected: + char rep; +public: + Char (const char ) {} + operator char() const; + void operator -= (const Char ); +}; + +inline Char operator - (const Char a, const Char b) { return Char(0); } +inline char operator == (const Char a, const char b) { return 0; } + +char mystrcmp(Char s[31], Char t[31]) +{ + for (; *s == *t; ++s, ++t) if (*s == '\0') return 0; + return char(*s - *t); +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/byval3.C b/gcc/testsuite/g++.old-deja/g++.jason/byval3.C new file mode 100644 index 000000000..f56fc1243 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/byval3.C @@ -0,0 +1,14 @@ +// { dg-do assemble } +// Test to make sure that value return of classes with cleanups works; it +// has been broken at various times on PCC_STATIC_STRUCT_RETURN targets. + +struct A {}; + +struct R : virtual A { virtual ~R(); }; + +R g(); + +void encode() +{ + g(); +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/c-inline.C b/gcc/testsuite/g++.old-deja/g++.jason/c-inline.C new file mode 100644 index 000000000..c16fbde7d --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/c-inline.C @@ -0,0 +1,11 @@ +// { dg-do assemble } +// Bug: the compiler gets hopelessly confused. + +#line 1 "c-inline.h" +#pragma interface +inline double abs (double) { return 0.0; } +inline short abs (short) { return 0; } +#line 2 "c-inline.C" +extern "C" { + inline int abs (int) { return 0; } // causes segfault - +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/cast1.C b/gcc/testsuite/g++.old-deja/g++.jason/cast1.C new file mode 100644 index 000000000..2bc16f352 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/cast1.C @@ -0,0 +1,8 @@ +// { dg-do assemble } +// Bug: g++ fails to grok functional casts in all situations. + +class A { +public: + typedef int B; + static B foo() { return B(1); } // { dg-bogus "" } +}; diff --git a/gcc/testsuite/g++.old-deja/g++.jason/cast2.C b/gcc/testsuite/g++.old-deja/g++.jason/cast2.C new file mode 100644 index 000000000..bd0fe7923 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/cast2.C @@ -0,0 +1,15 @@ +// { dg-do assemble } +// The compiler tried to build up a double with a NOP_EXPR from +// integer_zero_node, which fails. + +template +class vector { +public: + vector (int n, const T& value = T()) {} +}; + +void +foo (void) +{ + vector v (10); +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/cast3.C b/gcc/testsuite/g++.old-deja/g++.jason/cast3.C new file mode 100644 index 000000000..fa3474288 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/cast3.C @@ -0,0 +1,16 @@ +// { dg-do assemble } +// PRMS Id: 7088 + +struct string +{ + int length () const; + string (string &); + string (char * = 0); + int operator [] (int); + ~string (); +}; + +void _cook(const string raw, bool for_postscript) +{ + unsigned char c = (unsigned) ((string &)raw)[1]; +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/cleanup.C b/gcc/testsuite/g++.old-deja/g++.jason/cleanup.C new file mode 100644 index 000000000..adf824622 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/cleanup.C @@ -0,0 +1,24 @@ +// { dg-do run } +// Bug: continue over object decl calls destructor but not constructor. + +int c = 0; +int d = 0; +extern "C" int printf(const char *,...); + +class Foo { +public: + Foo(){ c++; } + ~Foo(){ d++; } +}; + +int main() +{ + for(int i=0;i<2;i++){ + continue; + Foo bar; + } + printf ("%d %d\n", c, d); + if (c == d && d == 0) + return 0; + return 1; +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/cleanup2.C b/gcc/testsuite/g++.old-deja/g++.jason/cleanup2.C new file mode 100644 index 000000000..5b933937b --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/cleanup2.C @@ -0,0 +1,15 @@ +// { dg-do assemble } +// PRMS Id: 6303 +// Bug: compiler crashes processing the cleanup for arrayOfClass. + +class Klasse { +public: + ~Klasse(); // This dtor MUST be declared to generate the error... +}; + +Klasse varOfClass; + +int main() { + // This MUST be 'const' to generate the error... + const Klasse arrayOfClass[1] = { varOfClass }; // causes abort +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/complete1.C b/gcc/testsuite/g++.old-deja/g++.jason/complete1.C new file mode 100644 index 000000000..d854ffdec --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/complete1.C @@ -0,0 +1,12 @@ +// { dg-do assemble } +// PRMS Id: 4695 +// Bug: g++ wrongly requires A to be complete here. + +struct A; + +void foo(const A &); + +void bar(A *p) +{ + foo(*p); +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/cond.C b/gcc/testsuite/g++.old-deja/g++.jason/cond.C new file mode 100644 index 000000000..d0616e4be --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/cond.C @@ -0,0 +1,58 @@ +// { dg-do assemble } +// GROUPS passed rtti +// Negative testcase for decls in conditions. + +int main() +{ + float i; + + if (int i = 1) // { dg-error "" "" { xfail *-*-* } } , + { + char i; // { dg-error "" "" { xfail *-*-* } } , + char j; + } + else + { + short i; // { dg-error "" "" { xfail *-*-* } } , + char j; + } + + while (int i = 0) // { dg-error "previously" } + { + int i; // { dg-error "redeclaration" } + } + + for (; int i = 0; ) // { dg-error "previously" } + { + int i; // { dg-error "redeclaration" } + } + + switch (int i = 0) // { dg-error "" "" { xfail *-*-* } } + { + default: + int i; // { dg-error "" "" { xfail *-*-* } } + } + + if (struct A { operator int () { return 1; } } *foo = new A) // { dg-error "defined" } + ; + + A bar; // { dg-error "not declared" "decl" } + // { dg-error "expected" "exp" { target *-*-* } 39 } + + if (enum A { one, two, three } foo = one) // { dg-error "defined" "def" } + // { dg-error "not declared" "expected" { target *-*-* } 42 } + ; + + struct B { operator int () { return 2; } }; + + if (struct B * foo = new B) + ; + + if (int f () = 1) // { dg-warning "extern" "extern" } + // { dg-error "is initialized like a variable" "var" { target *-*-* } 51 } + ; + + if (int a[2] = {1, 2}) // { dg-error "extended init" } + ; + +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/cond2.C b/gcc/testsuite/g++.old-deja/g++.jason/cond2.C new file mode 100644 index 000000000..d1ff6a9c7 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/cond2.C @@ -0,0 +1,66 @@ +// { dg-do run } +// 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; } +}; + +int 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; +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/condexp.C b/gcc/testsuite/g++.old-deja/g++.jason/condexp.C new file mode 100644 index 000000000..be333657d --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/condexp.C @@ -0,0 +1,14 @@ +// { dg-do assemble } +// PRMS id: 5629 + +struct String { const char *x; }; +class Pathname: public String { }; + +String +f(int i) +{ + Pathname p; + String s; + + return i ? p: s; +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/const.C b/gcc/testsuite/g++.old-deja/g++.jason/const.C new file mode 100644 index 000000000..7c497ee99 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/const.C @@ -0,0 +1,17 @@ +// { dg-do run } +// Bug: a ends up in the text segment, so trying to initialize it causes +// a seg fault. + +struct A { + int i; + A(): i(0) {} + A(int j): i(j) {} +}; + +const A a; +const A b(1); + +int main () +{ + return 0; +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/const2.C b/gcc/testsuite/g++.old-deja/g++.jason/const2.C new file mode 100644 index 000000000..b6aa6d4a7 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/const2.C @@ -0,0 +1,15 @@ +// { dg-do run } +// 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 + +int main() { } diff --git a/gcc/testsuite/g++.old-deja/g++.jason/const3.C b/gcc/testsuite/g++.old-deja/g++.jason/const3.C new file mode 100644 index 000000000..813b398c9 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/const3.C @@ -0,0 +1,11 @@ +// { dg-do run } +// Bug: bar isn't emitted, which causes havoc. + +extern int i; +const int bar = i; +int i = 5; + +int main() +{ + return bar != 5; +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/const4.C b/gcc/testsuite/g++.old-deja/g++.jason/const4.C new file mode 100644 index 000000000..d29c46b74 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/const4.C @@ -0,0 +1,25 @@ +// { dg-do assemble } +// PRMS Id: 8927 +// Bug: complex inheritance interferes with const checking + +class GrandParent { +public: + virtual void DoIt(); +protected: + int A; +}; + +class Parent : virtual public GrandParent { +public: + virtual void DoX() const; +}; + +class Child : public Parent { +public: + void DoX() const; +}; + +void Child::DoX() const +{ + A = 10; // { dg-error "" } assignment to const +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/context.C b/gcc/testsuite/g++.old-deja/g++.jason/context.C new file mode 100644 index 000000000..a4d30bf1f --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/context.C @@ -0,0 +1,20 @@ +// { dg-do assemble } +// PRMS Id: 3988 +// Bug: DECL_CONTEXT of A::B gets clobbered in pushdecl when defining A::foo(). + +#pragma implementation "context.h" +#line 1 "context.h" +#pragma interface + +template +struct A { + inline void foo () { } + class B { }; +}; + +struct C : public A { + void bar (C::B&); +}; +#line 2 "context.C" + +void C::bar (C::B& b) { } diff --git a/gcc/testsuite/g++.old-deja/g++.jason/conversion.C b/gcc/testsuite/g++.old-deja/g++.jason/conversion.C new file mode 100644 index 000000000..4c4b96117 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/conversion.C @@ -0,0 +1,16 @@ +// { dg-do assemble } +// Bug: g++ doesn't find the conversion path from DPtr& to B*. + +class B {}; +class D : public B {}; +class DPtr +{ +public: + operator D*() const; +}; + +void foo (B* bp); +void bar (DPtr& dp) +{ + foo (dp); +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/conversion10.C b/gcc/testsuite/g++.old-deja/g++.jason/conversion10.C new file mode 100644 index 000000000..8cbba413d --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/conversion10.C @@ -0,0 +1,19 @@ +// { dg-do assemble } +// PRMS Id: 9019 +// Bug: g++ doesn't find conversion to const char *. + +struct String { + String (); + explicit String (const char *); + operator const char * (); +}; + +int main(int argc, char **argv) +{ + String deflt("no args"); + String useme; + + const char *p = (argv[1]) ? argv[1] : deflt; + + return 0; +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/conversion11.C b/gcc/testsuite/g++.old-deja/g++.jason/conversion11.C new file mode 100644 index 000000000..6621a27b6 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/conversion11.C @@ -0,0 +1,29 @@ +// { dg-do assemble } +// PRMS Id: 8805 +// Bug: The two-level conversion is not found when calling a global fn. + +class Int { +public: + Int(int A); +}; + +class Ding { +public: + Ding(Int A); +}; + +class Something { +public: + void DoSomething(Ding A); // { dg-message "Something::DoSomething|no known conversion" } referred to +}; + +void DoSomething(Ding A); + +void foo(Something* pX) +{ + DoSomething(1); // { dg-error "could not convert" } + pX->DoSomething(1); // { dg-error "no matching" } + // { dg-message "candidate" "candidate note" { target *-*-* } 25 } + (*pX).DoSomething(1); // { dg-error "no matching" } + // { dg-message "candidate" "candidate note" { target *-*-* } 27 } +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/conversion2.C b/gcc/testsuite/g++.old-deja/g++.jason/conversion2.C new file mode 100644 index 000000000..ebc2bd1eb --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/conversion2.C @@ -0,0 +1,7 @@ +// { dg-do assemble } +// PRMS Id: 3069 + +void f(int&); // { dg-error "" } referenced by error below +void g(const int& i) { + f(i); // { dg-error "" } discarding const +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/conversion3.C b/gcc/testsuite/g++.old-deja/g++.jason/conversion3.C new file mode 100644 index 000000000..6dbd475c6 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/conversion3.C @@ -0,0 +1,8 @@ +// { dg-do assemble } +void qsort (void *, int, int, int (*)(const void *, const void *)); +int f (char *, char *); +void g () +{ + typedef int (*pf)(void *, void *); + qsort(0, 0, 0, pf(f)); // { dg-error "" } adding const to function parms +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/conversion4.C b/gcc/testsuite/g++.old-deja/g++.jason/conversion4.C new file mode 100644 index 000000000..68973a554 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/conversion4.C @@ -0,0 +1,14 @@ +// { dg-do assemble } +struct A { + A (int); +}; +struct B { + operator int () { return 1; } +}; +void f (const A&); +void g() +{ + B b; + f ((A) b); + f (A (b)); // { dg-bogus "" } functional cast treated differently from C style +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/conversion5.C b/gcc/testsuite/g++.old-deja/g++.jason/conversion5.C new file mode 100644 index 000000000..0031084db --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/conversion5.C @@ -0,0 +1,13 @@ +// { dg-do assemble } +// { dg-options "-Wconversion" } +struct A { }; +struct B: public A { + A a; + operator A () { return a; } // { dg-warning "" } never used implicitly +}; +void f (const A&); +void g() +{ + B b; + (A) b; // { dg-bogus "" } trying both constructor and type conversion operator +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/conversion6.C b/gcc/testsuite/g++.old-deja/g++.jason/conversion6.C new file mode 100644 index 000000000..5f5a51a2f --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/conversion6.C @@ -0,0 +1,41 @@ +// { dg-do run } +// PRMS Id: g++/6034 + +extern "C" int printf (const char *, ...); + +class Base +{ + char x; +}; + +template +// 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 TypeContainer; + +int main(void) +{ + TypeContainer myTypeContainer(2); + Type t = myTypeContainer; + + printf ("myType = %d\n", t); + return t != 2; +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/conversion7.C b/gcc/testsuite/g++.old-deja/g++.jason/conversion7.C new file mode 100644 index 000000000..925433ef6 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/conversion7.C @@ -0,0 +1,17 @@ +// { dg-do run } +// Bug: g++ tries to look inside (B*)0 for a virtual base pointer. + +struct A +{ +}; + +struct B : virtual A +{ +}; + +A* a; + +int main() +{ + a = (B*)0; +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/conversion8.C b/gcc/testsuite/g++.old-deja/g++.jason/conversion8.C new file mode 100644 index 000000000..c23b0dedd --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/conversion8.C @@ -0,0 +1,11 @@ +// { dg-do run } +// PRMS id: 8279 + +int main () +{ + char *const *p = 0; + char **q = 0; + + (void)(p - q); + (void)(q - p); +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/conversion9.C b/gcc/testsuite/g++.old-deja/g++.jason/conversion9.C new file mode 100644 index 000000000..aeda02816 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/conversion9.C @@ -0,0 +1,14 @@ +// { dg-do run } +// PRMS Id: 8475 + +class SomeClass { +public: + operator int & () { + static int x; + return x; + } +} a; + +int main (int, char**) { + return a + 0; +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/crash1.C b/gcc/testsuite/g++.old-deja/g++.jason/crash1.C new file mode 100644 index 000000000..078f349ce --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/crash1.C @@ -0,0 +1,29 @@ +// { dg-do assemble } +// Bug: g++ dies on this input. + +class Sample + { + public: + int operator <<(const char *c); + }; + +extern Sample sample; + +struct Simple + { + int a; + }; + +extern "C" void get_it(); + +class Test + { + private: + void test(); + friend void get_it(); + }; + +void Test::test() + { + sample << "hello"; + } diff --git a/gcc/testsuite/g++.old-deja/g++.jason/crash10.C b/gcc/testsuite/g++.old-deja/g++.jason/crash10.C new file mode 100644 index 000000000..cd9b7b0b2 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/crash10.C @@ -0,0 +1,8 @@ +// { dg-do assemble } +// PRMS Id: 5155 + +struct A { + enum foo { bar }; +}; + +typedef A::foo A::foo; // { dg-error "" } causes compiler segfault diff --git a/gcc/testsuite/g++.old-deja/g++.jason/crash11.C b/gcc/testsuite/g++.old-deja/g++.jason/crash11.C new file mode 100644 index 000000000..1883e175a --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/crash11.C @@ -0,0 +1,9 @@ +// { dg-do assemble } +// Bug: g++ crashes on this input. + +struct A { + const char *p; +}; +const char foo[] = "bar"; +const A a = { foo }; +extern const A* ap = &a; //{ dg-warning "'ap' initialized and declared 'extern'" } diff --git a/gcc/testsuite/g++.old-deja/g++.jason/crash12.C b/gcc/testsuite/g++.old-deja/g++.jason/crash12.C new file mode 100644 index 000000000..c3906a8d1 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/crash12.C @@ -0,0 +1,10 @@ +// { dg-do assemble } +// Bug: g++ dies instead of flagging this invalid. + +inline float max(float x, float y) { return (x>y)?x:y; } + +float b(float x, float y, float z) +{ + float f = (y +class cc_Array : public ccObjectInfo +{ +public: + virtual const ccObjectInfo& repInvariant (int =0) const ; +}; + +template +const ccObjectInfo& cc_Array::repInvariant(int) const // { dg-error "previously declared" } +{ return *this /* *this is required here */; } + +template +class ccArray :public ccObjectInfo +{ + ccArray (cc_Array*); +}; + +template +class ccObjArray : public ccArray +{ + ccObjArray(); +}; + +template +const ccObjectInfo& cc_Array::repInvariant(int) const // { dg-error "redefinition" } +{ return 0; } + +typedef ccObjArray< double> ccROIRuns; diff --git a/gcc/testsuite/g++.old-deja/g++.jason/crash5.C b/gcc/testsuite/g++.old-deja/g++.jason/crash5.C new file mode 100644 index 000000000..ae9e0e577 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/crash5.C @@ -0,0 +1,4 @@ +// { dg-do assemble } +// Bug: g++ doesn't deal well with abstract declarators used inappropriately. + +void (*)(); // { dg-error "" } diff --git a/gcc/testsuite/g++.old-deja/g++.jason/crash6.C b/gcc/testsuite/g++.old-deja/g++.jason/crash6.C new file mode 100644 index 000000000..274f3386a --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/crash6.C @@ -0,0 +1,9 @@ +// { dg-do assemble } +// Bug: g++ dies on the below. + +class A { }; +void f () +{ + A a; + a.~a(); // { dg-error "" } causes segfault +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/crash7.C b/gcc/testsuite/g++.old-deja/g++.jason/crash7.C new file mode 100644 index 000000000..95c7c2fb5 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/crash7.C @@ -0,0 +1,6 @@ +// { dg-do assemble } +// Bug: g++ can't deal. + +typedef unsigned size_t; // { dg-error "" } previous declaration +typedef unsigned long size_t; // { dg-error "" } redefining size_t +void f (size_t); // causes compiler segfault - diff --git a/gcc/testsuite/g++.old-deja/g++.jason/crash8.C b/gcc/testsuite/g++.old-deja/g++.jason/crash8.C new file mode 100644 index 000000000..061652db2 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/crash8.C @@ -0,0 +1,10 @@ +// { dg-do assemble } +struct A { + A(); + A(A); // { dg-error "" } copy ctor must take reference +}; +int main() +{ + A a; + A b(a); // causes compiler segfault +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/crash9.C b/gcc/testsuite/g++.old-deja/g++.jason/crash9.C new file mode 100644 index 000000000..292d3548c --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/crash9.C @@ -0,0 +1,29 @@ +// { dg-do assemble } +// PRMS Id: 5085 +// Bug: TYPE_POINTER_TO wasn't set. + +class A { + A(const A &); + void operator=(const A &); +public: + inline A(); +}; + +class B { + A a; +public: + B(); + virtual void f() const; +}; + +class C : public B { }; + +class D : C { +public: + void f() const; +}; + +void D::f() const +{ + C::f(); +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/ctor1.C b/gcc/testsuite/g++.old-deja/g++.jason/ctor1.C new file mode 100644 index 000000000..739071957 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/ctor1.C @@ -0,0 +1,27 @@ +// { dg-do run } +// PRMS Id: 5584 + +extern "C" +{ + struct xx { + void (*xx)(void); + int x,y; + }; +} + +int r = 1; + +void f(void) +{ + r = 0; +} + +int main() +{ + struct xx p; + + p.xx = f; + p.xx(); + + return r; +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/ctor2.C b/gcc/testsuite/g++.old-deja/g++.jason/ctor2.C new file mode 100644 index 000000000..e396dc064 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/ctor2.C @@ -0,0 +1,16 @@ +// { dg-do assemble } +// Bug: the reference to c in the initializer list doesn't get fixed up. + +struct AP { + AP(unsigned char); +}; + +struct AI : AP { + AI(unsigned char); +}; + +AI::AI(unsigned char c) +: AP(c) +{ + &c; +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/dcast1.C b/gcc/testsuite/g++.old-deja/g++.jason/dcast1.C new file mode 100644 index 000000000..9336cba11 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/dcast1.C @@ -0,0 +1,20 @@ +// { dg-do assemble } +// PRMS Id: 7162 + +struct B { + int i; + B() : i(1) {} +}; + +struct D : B { + int i; + D() : i(2) {} +}; + +void ch() +{ + D od2; + D &rd2 = od2; + + B &rd1 = dynamic_cast(rd2); +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/dcast2.C b/gcc/testsuite/g++.old-deja/g++.jason/dcast2.C new file mode 100644 index 000000000..62740834a --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/dcast2.C @@ -0,0 +1,19 @@ +// { dg-do run } +struct A { virtual void f() { } }; +struct B { virtual void g() { } }; +struct C : public A, public B { }; + +int main () +{ + C* cp = 0; + B* bp = 0; + + if (dynamic_cast (cp) != 0) + return 1; + + if (dynamic_cast (bp) != 0) + return 1; + + if (dynamic_cast (bp) != 0) + return 1; +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/dcast3.C b/gcc/testsuite/g++.old-deja/g++.jason/dcast3.C new file mode 100644 index 000000000..a6179187f --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/dcast3.C @@ -0,0 +1,33 @@ +// { dg-do run } +// 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 { }; + +int main () +{ + E e; + E2 e2; + + A* ap = (C*)&e; + + // ap points to base subobject of unique B; succeeds + if (dynamic_cast (ap) == 0) + return 1; + + ap = (C2*)&e2; + // ap points to base subobject shared by two Bs; fails + if (dynamic_cast (ap) != 0) + return 2; +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/default1.C b/gcc/testsuite/g++.old-deja/g++.jason/default1.C new file mode 100644 index 000000000..afbac13bf --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/default1.C @@ -0,0 +1,16 @@ +// { dg-do assemble } +// 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. + +int add(int const &symbol, + const unsigned char flags=(void*)0); // { dg-error "" } invalid default arg + +int add_sym(int const &symbol, + const unsigned char flags=0); + +int main() +{ + int fname; + add_sym(fname); // Guarantee a symbol exists +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/default2.C b/gcc/testsuite/g++.old-deja/g++.jason/default2.C new file mode 100644 index 000000000..167ac635d --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/default2.C @@ -0,0 +1,31 @@ +// { dg-do assemble } +// PRMS Id: 5921 +// Bug: default arguments containing constructor calls persist incorrectly. + +class foo +{ + public: + foo(); + foo(int x); + public: + int iamamember; +}; + +class bar +{ + public: + bar(); + int memberfunction(int i, const char *j, double k, foo foo1 = foo(0)); +}; + +int +pain(bar *bar1) +{ + return bar1->memberfunction(1, "x", 0.0); +} + +int +pain2(bar *bar1) +{ + return bar1->memberfunction(1, "x", 0.0); +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/default3.C b/gcc/testsuite/g++.old-deja/g++.jason/default3.C new file mode 100644 index 000000000..3e4951c8d --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/default3.C @@ -0,0 +1,6 @@ +// { dg-do assemble } +// Bug: type_list_equal aborts when it sees lang-specific tree nodes. + +struct A { }; +void f (A a = A()); +void g (A a = A()); diff --git a/gcc/testsuite/g++.old-deja/g++.jason/defctor.C b/gcc/testsuite/g++.old-deja/g++.jason/defctor.C new file mode 100644 index 000000000..76efaa1f0 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/defctor.C @@ -0,0 +1,16 @@ +// { dg-do run } +// Bug: g++ doesn't generate default constructor. + +class A { +public: + int i; +}; + +extern "C" int printf(const char *, ...); + +int main () { + A a; + a.i = 1; + A b (a); + printf("%d\n",b.i); +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/delete1.C b/gcc/testsuite/g++.old-deja/g++.jason/delete1.C new file mode 100644 index 000000000..b170b2db6 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/delete1.C @@ -0,0 +1,6 @@ +// { dg-do assemble } +#include +struct A { + virtual void operator delete (void *); // { dg-error "" } virtual delete + virtual void * operator new (size_t); // { dg-error "" } virtual new +}; diff --git a/gcc/testsuite/g++.old-deja/g++.jason/delete2.C b/gcc/testsuite/g++.old-deja/g++.jason/delete2.C new file mode 100644 index 000000000..c6230eef1 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/delete2.C @@ -0,0 +1,16 @@ +// { dg-do assemble } +// PRMS Id: 5003 +// Bug: g++ complains about calling the destructor for a const object. + +struct A { +public: + ~A(); +}; + +const A foo (); + +void bar() +{ + A n; + n = foo(); // { dg-bogus "" } deleting const +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/delete3.C b/gcc/testsuite/g++.old-deja/g++.jason/delete3.C new file mode 100644 index 000000000..bde62d968 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/delete3.C @@ -0,0 +1,19 @@ +// { dg-do assemble } +// PRMS Id: 6093 + +class A { +public: + A(); + ~A(); +protected: + void operator delete(void *); // { dg-error "" } protected +}; + +A::~A() +{ +} + +void foo(A *p) +{ + delete p; // { dg-error "" } in this context +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/destruct.C b/gcc/testsuite/g++.old-deja/g++.jason/destruct.C new file mode 100644 index 000000000..b0f2dfe10 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/destruct.C @@ -0,0 +1,34 @@ +// { dg-do assemble } +// Exhaustive test for destructors of simple types. +// PRMS Id: 2744, 3308 + +template class A { + T q; +public: + ~A() { + q.T::~T(); + q.~T(); + (&q)->T::~T(); + (&q)->~T(); + } +}; + +typedef char * cp; +typedef int I; + +int main () +{ + A a; + A b; + int i; + cp c; + + i.~I(); + i.I::~I(); + (&i)->~I(); + (&i)->I::~I(); + c.~cp(); + c.cp::~cp(); + (&c)->~cp(); + (&c)->cp::~cp(); +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/destruct2.C b/gcc/testsuite/g++.old-deja/g++.jason/destruct2.C new file mode 100644 index 000000000..62c8f8fba --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/destruct2.C @@ -0,0 +1,20 @@ +// { dg-do assemble } +// PRMS Id: 4342 +// Bug: g++ does not massage things enough to allow calling ~X(). + +struct X +{ + virtual ~X (); +}; + +struct Y : public X +{}; + +struct Z : public Y, public X // { dg-warning "" } +{}; + +void foo () +{ + Z* f = new Z; + delete f; // { dg-bogus "" } +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/destruct3.C b/gcc/testsuite/g++.old-deja/g++.jason/destruct3.C new file mode 100644 index 000000000..3dc287c74 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/destruct3.C @@ -0,0 +1,45 @@ +// { dg-do assemble } +// { dg-options "-w" } +// PRMS Id: 4342 (second testcase) +// Bug: g++ still can't deal with ambiguous inheritance in destructor calls. + +struct ccUnwind +{ + ccUnwind (); + virtual ~ccUnwind (); +}; + +struct ccPersistent +{ + virtual void bar(); +}; + +struct ccImpExp : public ccPersistent, public ccUnwind +{}; + +struct ccTool : public ccImpExp +{}; + +struct ccScreenTool : public ccTool +{}; + +struct ccVTool : public ccScreenTool +{}; + +struct ccScreenObjRep : public ccUnwind +{}; + +struct ccScreenObj : public ccScreenObjRep +{}; + +struct ccVSTool : public ccImpExp, public ccUnwind +{}; + +struct ccSCCP : public ccVSTool +{}; + +void foo () +{ + ccSCCP* foo = new ccSCCP; + delete foo; +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/destruct4.C b/gcc/testsuite/g++.old-deja/g++.jason/destruct4.C new file mode 100644 index 000000000..4d4800b32 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/destruct4.C @@ -0,0 +1,14 @@ +// { dg-do assemble } +// PRMS Id: 4342 +// Bug: g++ fails to massage ambiguity in calling virtual destructor. + +class A { public: virtual ~A();}; +class B: public A { }; +class C: public A { }; +class D: public B, public C { }; + +void foo () +{ + D* p = new D; + delete p; +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/dot.C b/gcc/testsuite/g++.old-deja/g++.jason/dot.C new file mode 100644 index 000000000..41b8d814f --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/dot.C @@ -0,0 +1,20 @@ +// { dg-do assemble } +// PRMS Id: 4143 +// Bug: Pointer is silently dereferenced in method call. + +extern "C" int printf (const char *, ...); + +class Test +{ + char ch; + public: + Test(char c) : ch(c) {} + void Print() { printf("%c", ch); } +}; + +int main() +{ + Test *p = new Test('x'); + + p.Print(); // { dg-error "" } +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/dtor.C b/gcc/testsuite/g++.old-deja/g++.jason/dtor.C new file mode 100644 index 000000000..2dc5f8cd6 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/dtor.C @@ -0,0 +1,14 @@ +// { dg-do assemble } +struct A { + ~A(); +}; + +struct B { + ~B(); +}; + +int main() +{ + A a; + a.~B(); // { dg-error "" } wrong name +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/dtor2.C b/gcc/testsuite/g++.old-deja/g++.jason/dtor2.C new file mode 100644 index 000000000..fa1e0a92b --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/dtor2.C @@ -0,0 +1,11 @@ +// { dg-do run } +// PRMS Id: 5163 +// Bug: g++ doesn't accept the explicit destructor call syntax for templates. + +template struct A { }; +A a; + +int main() +{ + a.~A(); // { dg-bogus "" } +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/dtor3.C b/gcc/testsuite/g++.old-deja/g++.jason/dtor3.C new file mode 100644 index 000000000..8eb887e27 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/dtor3.C @@ -0,0 +1,18 @@ +// { dg-do assemble } +// PRMS Id: 5341 +// Bug: g++ complains about the explicit destructor notation. + +#include + +void *operator new(size_t Size, void* pThing) { return pThing; } + +template class Stack { +public: + Stack() { new (Data) T(); } + ~Stack() { ((T*)Data)->~T(); } +private: + char Data[sizeof(T)]; +}; + +Stack a; +Stack > c; diff --git a/gcc/testsuite/g++.old-deja/g++.jason/dtor4.C b/gcc/testsuite/g++.old-deja/g++.jason/dtor4.C new file mode 100644 index 000000000..25ef1cfe7 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/dtor4.C @@ -0,0 +1,23 @@ +// { dg-do assemble } +// PRMS Id: 5420 +// Bug: g++ gets mixed up calling destructors for references. + +template +class Z { +public: + char space[100]; + void kill() + { X& x = (X&) space[0]; + x.~X(); } +}; + +class C { int i; }; + +void +f() +{ + Z r; + r.kill(); + Z s; + s.kill(); +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/dtor5.C b/gcc/testsuite/g++.old-deja/g++.jason/dtor5.C new file mode 100644 index 000000000..3cf1d1cd0 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/dtor5.C @@ -0,0 +1,26 @@ +// { dg-do run } +// PRMS Id: 5286 +// Bug: g++ forgets side-effects of object in call to nonexistent destructor. + +#include + +int r; + +template struct A { + T *p; + int i; + A() { i = 0; p = (T*) new char[sizeof (T)]; new (p + i++) T; } + ~A() { p[--i].~T(); r = i; } +}; + +int main() +{ + { A a; } + + int* p = (int*) new char[sizeof (int)]; + new (p + r++) int; + typedef int I; + p[--r].~I(); + + return r; +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/enum.C b/gcc/testsuite/g++.old-deja/g++.jason/enum.C new file mode 100644 index 000000000..81b4574d8 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/enum.C @@ -0,0 +1,19 @@ +// { dg-do assemble } +// PRMS Id: 4337 +// Bug: Enums are not looked up to arbitrary depth. + +struct W { + enum A { B }; +}; + +struct X : public W +{}; + +struct Y : public X +{}; + +struct S +{ + X::A a1; + Y::A a2; // { dg-bogus "" } +}; diff --git a/gcc/testsuite/g++.old-deja/g++.jason/enum2.C b/gcc/testsuite/g++.old-deja/g++.jason/enum2.C new file mode 100644 index 000000000..2991af6ca --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/enum2.C @@ -0,0 +1,8 @@ +// { dg-do assemble } + +enum tristate { no = -1, maybe, yes }; + +void foobar () +{ + tristate var = no; // { dg-bogus "" } +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/enum3.C b/gcc/testsuite/g++.old-deja/g++.jason/enum3.C new file mode 100644 index 000000000..04e8f287b --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/enum3.C @@ -0,0 +1,19 @@ +// { dg-do assemble } +// { dg-options "-Wall" } + +enum tristate { no = -1, maybe, yes }; + +tristate +tristate_satisfies (register tristate const t1, register tristate const t2) +{ + switch (t1) + { + case no: + return (tristate) -t2; + case maybe: + return yes; + case yes: + return t2; + } + return maybe; +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/enum4.C b/gcc/testsuite/g++.old-deja/g++.jason/enum4.C new file mode 100644 index 000000000..b8b1209d3 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/enum4.C @@ -0,0 +1,10 @@ +// { dg-do assemble } +// { dg-options "-Wall" } + +enum tristate { no = -1, maybe, yes }; + +tristate +definite_tristate (int truth) +{ + return (truth) ? yes : no; +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/enum5.C b/gcc/testsuite/g++.old-deja/g++.jason/enum5.C new file mode 100644 index 000000000..a05d4d346 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/enum5.C @@ -0,0 +1,9 @@ +// { dg-do run } +enum { a = 1 }; + +int main(void) +{ + int l = -1; + + return ! (l < a); // testcase fails if a is unsigned +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/enum6.C b/gcc/testsuite/g++.old-deja/g++.jason/enum6.C new file mode 100644 index 000000000..7be0cd868 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/enum6.C @@ -0,0 +1,27 @@ +// { dg-do run } +// { dg-options "-fshort-enums" } + +// On ARM EABI targets this testcase will cause a warning to be emitted +// whilst EABI attributes are being merged at link time unless +// the --no-enum-size-warning option is passed to the linker. Whilst the +// enum-size attributes should only be emitted if there are values of +// enum type that can escape the compilation unit, gcc cannot currently +// detect this; if this facility is added then this linker option should +// not be needed. arm-*-linux*eabi should be a good approximation to +// those platforms where the EABI supplement defines enum values to be +// 32 bits wide. +// { dg-options "-fshort-enums -Wl,--no-enum-size-warning" { target arm*-*-linux*eabi } } + +#include + +enum A { a1 = 0x7fffffff }; +enum B { b1 = 0x80000000 }; +enum C { c1 = -1, c2 = 0x80000000 }; +enum D { d1 = CHAR_MIN, d2 = CHAR_MAX }; +enum E { e1 = CHAR_MIN, e2 = CHAR_MIN }; + +main() +{ + return (sizeof (A) != 4 || sizeof (B) != 4 || sizeof (C) != 8 + || sizeof (D) != 1 || sizeof (E) != 1); +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/enum7.C b/gcc/testsuite/g++.old-deja/g++.jason/enum7.C new file mode 100644 index 000000000..38720efba --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/enum7.C @@ -0,0 +1,15 @@ +// { dg-do assemble } +// Yet Another testcase for signed/unsigned enums. + +enum A { AA = 0, AB = 1}; +enum B { BA = -1, BB = 1}; + +void set(int a); +void set(long a); + +void +foo() +{ + set(AA); // { dg-bogus "" } why is this ambiguous + set(BA); // when this is not amibguous +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/enum8.C b/gcc/testsuite/g++.old-deja/g++.jason/enum8.C new file mode 100644 index 000000000..9d0d94bf4 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/enum8.C @@ -0,0 +1,21 @@ +// { dg-do run } +// 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; + } +} + +int main () +{ + return f (one); +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/explicit.C b/gcc/testsuite/g++.old-deja/g++.jason/explicit.C new file mode 100644 index 000000000..e227792a0 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/explicit.C @@ -0,0 +1,15 @@ +// { dg-do assemble } +// Testcase for explicit instantiation of templates. + +template +class A { + T t; +public: + void f () { } +}; + +template class A; + +template T min (T a, T b) { return (a < b ? a : b); } + +template int min (int, int); diff --git a/gcc/testsuite/g++.old-deja/g++.jason/expr1.C b/gcc/testsuite/g++.old-deja/g++.jason/expr1.C new file mode 100644 index 000000000..701e5a28a --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/expr1.C @@ -0,0 +1,12 @@ +// { dg-do assemble } +// Bug: g++ doesn't figure out what to do. + +struct A { + operator char *(); +}; + +char foo(A a) +{ + char c = a[0]; // { dg-bogus "" } + return c; +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/friend.C b/gcc/testsuite/g++.old-deja/g++.jason/friend.C new file mode 100644 index 000000000..9bcc81488 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/friend.C @@ -0,0 +1,20 @@ +// { dg-do run } +// 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 (B) { f (); } +}; + +int main () +{ + B b; + g (b); +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/friend2.C b/gcc/testsuite/g++.old-deja/g++.jason/friend2.C new file mode 100644 index 000000000..7264bd3b8 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/friend2.C @@ -0,0 +1,21 @@ +// { dg-do assemble } +// PRMS Id: 5189 +// Bug: g++ fails to collapse the several declarations of freefoo, so it isn't +// recognized as a friend. + +extern "C" +void freefoo(void); + +class foo { + friend void freefoo(void); + protected: + static void foomem(); + public: + foo(); + ~foo(); +}; + +void freefoo(void) +{ + foo::foomem(); +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/groff1.C b/gcc/testsuite/g++.old-deja/g++.jason/groff1.C new file mode 100644 index 000000000..636317956 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/groff1.C @@ -0,0 +1,41 @@ +// { dg-do run } +// 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); +} + +int main() +{ + A pos; + pos.x = 17; + pos.y = 12; + S s; + s.foo(pos); + return 0; +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/hmc1.C b/gcc/testsuite/g++.old-deja/g++.jason/hmc1.C new file mode 100644 index 000000000..b023125cf --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/hmc1.C @@ -0,0 +1,19 @@ +// { dg-do assemble } +// GROUPS passed templates default-arguments +template +class Klasse { +public: + void func1(int n=1); + void func2(int d) {} +}; +template +void Klasse::func1(int n) {} + +//if this is replaced by: +//void Klasse::func1(int n=1) {} +//the code compiles. + +int main() { + Klasse C; + return 0; +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/incomplete1.C b/gcc/testsuite/g++.old-deja/g++.jason/incomplete1.C new file mode 100644 index 000000000..e43ca711a --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/incomplete1.C @@ -0,0 +1,15 @@ +// { dg-do assemble } +// The reference parameter to fred isn't dereferenced properly. + +class Gump {}; +Gump operator & (const Gump x){return x;} + +class B; + +void *sam(int &x) +{return &x;} + +const void *fred(const B& x) +{return &x;} // "&x" causes the compilation error. + +class B {}; diff --git a/gcc/testsuite/g++.old-deja/g++.jason/incomplete2.C b/gcc/testsuite/g++.old-deja/g++.jason/incomplete2.C new file mode 100644 index 000000000..f102220c6 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/incomplete2.C @@ -0,0 +1,7 @@ +// { dg-do assemble } + +struct A { + int foo(A a) { return a.bar(); } + int bar(); + int n; +}; diff --git a/gcc/testsuite/g++.old-deja/g++.jason/init.C b/gcc/testsuite/g++.old-deja/g++.jason/init.C new file mode 100644 index 000000000..6bb60d56c --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/init.C @@ -0,0 +1,7 @@ +// { dg-do assemble } +// Bug: g++ uses an empty initializer list for its own devious purpose +// internally, and gets confused if it shows up in the input. + +struct A { int i; }; + +A a = { }; diff --git a/gcc/testsuite/g++.old-deja/g++.jason/init2.C b/gcc/testsuite/g++.old-deja/g++.jason/init2.C new file mode 100644 index 000000000..d1507afac --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/init2.C @@ -0,0 +1,10 @@ +// { dg-do run } +// PRMS Id: 5126 + +extern int i, j; +static const int foo [] = { i, j }; +int i = 5, j = 42; +int main() +{ + return foo[1] != 42; +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/init3.C b/gcc/testsuite/g++.old-deja/g++.jason/init3.C new file mode 100644 index 000000000..38e0e61d3 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/init3.C @@ -0,0 +1,42 @@ +// { dg-do run } +// PRMS Id: 5652 +// Bug: strings does not get initialized. + +#include + +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); +} + +int main() +{ + My_string str1 = strings[0]; + return strcmp ("first string", str1.char_p ()) != 0; +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/init4.C b/gcc/testsuite/g++.old-deja/g++.jason/init4.C new file mode 100644 index 000000000..2a937d5c4 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/init4.C @@ -0,0 +1,4 @@ +// { dg-do assemble } +struct A { int i; }; + +A a = {{{1}}}; // { dg-error "" } causes abort diff --git a/gcc/testsuite/g++.old-deja/g++.jason/inline.C b/gcc/testsuite/g++.old-deja/g++.jason/inline.C new file mode 100644 index 000000000..d614d541a --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/inline.C @@ -0,0 +1,22 @@ +// { dg-do run } +// 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 A {}; +#line 1 "C.h" +#pragma interface +template class C +{ +public: + C() { A *ap; } + ~C() { } +}; +#line 18 "inline.C" +int main() +{ + C c; +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/inline2.C b/gcc/testsuite/g++.old-deja/g++.jason/inline2.C new file mode 100644 index 000000000..b6198be14 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/inline2.C @@ -0,0 +1,12 @@ +// { dg-do assemble } +// { dg-options "-O" } +// Bug: the lang-specific bits of the decl for g aren't being copied when +// inlining. + +inline void f () { + void g (); +} + +void h() { + f(); // causes compiler segfault - +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/inline3.C b/gcc/testsuite/g++.old-deja/g++.jason/inline3.C new file mode 100644 index 000000000..a314b2029 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/inline3.C @@ -0,0 +1,43 @@ +// { dg-do run } +// { dg-options "-O2" } +// Testcase for order of destruction. + +extern "C" int printf (const char *, ...); +int c; +int r; + +struct B { + B(); + B( B const& ); + ~B(); +}; + +struct A { + A(); + A( A const& ); + ~A(); + operator B (); +}; + +inline A::operator B () { printf( "operator B ()\n"); return B(); } + +A f(); +void g( B const& ); + +int +main() +{ + g( f() ); + return r; +} + +B::B() { printf( "B::B()\n" ); if (++c != 2) r = 1; } +B::B( B const& ) { printf( "B::B( B const& )\n" ); r = 1; } +B::~B() { printf( "B::~B()\n" ); if (--c != 1) r = 1; } + +A::A() { printf( "A::A()\n" ); if (++c != 1) r = 1; } +A::A( A const& ) { printf( "A::A( A const& )\n" ); r = 1; } +A::~A() { printf( "A::~A()\n" ); if (--c != 0) r = 1; } + +A f() { printf( "f()\n"); return A(); } +void g( B const& ) { printf( "g()\n"); } diff --git a/gcc/testsuite/g++.old-deja/g++.jason/jump.C b/gcc/testsuite/g++.old-deja/g++.jason/jump.C new file mode 100644 index 000000000..d720a9288 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/jump.C @@ -0,0 +1,15 @@ +// { dg-do assemble } +// PRMS Id: 6036 + +extern int a; + +int main() { + switch (a) { + case 1: + int v2 = 3; // { dg-error "" } referenced below + case 2: // { dg-error "" } jumping past initializer + if (v2 == 7) + ; + } + return 0; +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/lex1.C b/gcc/testsuite/g++.old-deja/g++.jason/lex1.C new file mode 100644 index 000000000..f183da1b7 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/lex1.C @@ -0,0 +1,7 @@ +// { dg-do run } +int main() +{ + char c = '\351'; + if (c != '\351') + return 1; +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/lineno.C b/gcc/testsuite/g++.old-deja/g++.jason/lineno.C new file mode 100644 index 000000000..bd5a393e5 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/lineno.C @@ -0,0 +1,6 @@ +// { dg-do assemble } +// Bug; g++ binds a function definition to the line number of a later decl. + +void foo () { } // { dg-error "" } redeclared +void foo (); // { dg-bogus "" } invalid binding +void foo () { } // { dg-error "" } redeclared diff --git a/gcc/testsuite/g++.old-deja/g++.jason/lineno2.C b/gcc/testsuite/g++.old-deja/g++.jason/lineno2.C new file mode 100644 index 000000000..7f3317649 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/lineno2.C @@ -0,0 +1,14 @@ +// { dg-do assemble } +// { dg-options "" } +// GROUPS passed error-reporting +// Bug: # line directive gets ignored immediately after text. +template class A +{ +public: +# 200 "lineno2.C" +}; + +main() +{ + undef1(); // { dg-error "" "" { target *-*-* } 204 } +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/lineno3.C b/gcc/testsuite/g++.old-deja/g++.jason/lineno3.C new file mode 100644 index 000000000..997267e72 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/lineno3.C @@ -0,0 +1,14 @@ +// { dg-do assemble } +// { dg-options "" } +// GROUPS passed error-reporting +// potential bug: # line directive does not get reproduced in template +// expansion +template class A +{ +public: +# 200 "lineno3.C" + int foo () { undef1(); } // { dg-error "" "" { target *-*-* } 200 } + // { dg-message "note" "note" { target *-*-* } 200 } +}; + +template class A; diff --git a/gcc/testsuite/g++.old-deja/g++.jason/lineno4.C b/gcc/testsuite/g++.old-deja/g++.jason/lineno4.C new file mode 100644 index 000000000..caa5bc216 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/lineno4.C @@ -0,0 +1,14 @@ +// { dg-do assemble } +// { dg-options "" } +// GROUPS passed error-reporting +// Bug: # line directive in template definition interferes with growing obstack +template class A +{ +public: + +# 200 "lineno4.C" + int foo () { undef1(); } // { dg-error "" "" { target *-*-* } 200 } + // { dg-message "note" "note" { target *-*-* } 200 } +}; + +template class A; diff --git a/gcc/testsuite/g++.old-deja/g++.jason/lineno5.C b/gcc/testsuite/g++.old-deja/g++.jason/lineno5.C new file mode 100644 index 000000000..f723a222b --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/lineno5.C @@ -0,0 +1,10 @@ +// { dg-do assemble } +// GROUPS passed error-reporting +// Bug: incomplete instantiation messes with lineno +template class A; + +int main() +{ + A *p; + undef1();// { dg-error "" } +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/local.C b/gcc/testsuite/g++.old-deja/g++.jason/local.C new file mode 100644 index 000000000..21fa9f587 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/local.C @@ -0,0 +1,21 @@ +// { dg-do assemble } +// General testcase for local classes. + +int x; +void f () +{ + static int s; + int x; // { dg-error "" } referenced below + extern int q(); + + struct local { + int g() { return x; } // { dg-error "" } automatic variable + int h() { return s; } // { dg-bogus "" } local class + int k() { return ::x; } // OK + int l() { return q(); } // OK + int m(); // OK - not defined + static int foo; // { dg-error "" } static data member of local class + }; +} + +local* p = 0; // { dg-error "" } no such type in scope diff --git a/gcc/testsuite/g++.old-deja/g++.jason/lookup.C b/gcc/testsuite/g++.old-deja/g++.jason/lookup.C new file mode 100644 index 000000000..fe800835f --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/lookup.C @@ -0,0 +1,30 @@ +// { dg-do assemble } +// PRMS Id: 4357 +// Bug: g++ forgets to clear out push/popclass cache stuff when instantiating +// templates. + +template class ccHandle { }; + +class cc_GStack +{ + static cc_GStack* freeList; +}; + +// OK if ccGStack is not derived from ccHandle +class ccGStack : public ccHandle { }; + +struct S { }; + +S* freeList; + +class X +{ +public: + void foo(); +}; + +void X::foo() +{ + S m; + freeList = &m; +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/lookup2.C b/gcc/testsuite/g++.old-deja/g++.jason/lookup2.C new file mode 100644 index 000000000..a5cbccc34 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/lookup2.C @@ -0,0 +1,13 @@ +// { dg-do assemble } + +struct A { + struct B { + B (); + }; +}; +void f (A::B); +void g () +{ + A::B b; + f (b); // { dg-bogus "" } can't find nested constructor +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/lookup3.C b/gcc/testsuite/g++.old-deja/g++.jason/lookup3.C new file mode 100644 index 000000000..ecef53420 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/lookup3.C @@ -0,0 +1,15 @@ +// { dg-do assemble } +// [class.ambig]: A single function, object, type, or enumerator may be +// reached through more than one path through the DAG of base classes. This +// is not an ambiguity. + +struct A { + typedef long T; +}; + +struct B : public A { }; +struct C : public A { }; + +struct D : public C , public B { + void f (T&); // { dg-bogus "" } ambiguous lookup +}; diff --git a/gcc/testsuite/g++.old-deja/g++.jason/loverload.C b/gcc/testsuite/g++.old-deja/g++.jason/loverload.C new file mode 100644 index 000000000..3bffa3899 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/loverload.C @@ -0,0 +1,11 @@ +// { dg-do assemble } +// Bug: g++ can't deal with multi-language overloading. + +extern void foo (int, int); +extern "C" void foo (int); + +void bar () +{ + foo (1); + foo (1, 2); +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/loverload3.C b/gcc/testsuite/g++.old-deja/g++.jason/loverload3.C new file mode 100644 index 000000000..7a765a6d9 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/loverload3.C @@ -0,0 +1,12 @@ +// { dg-do assemble } +// PRMS Id: 2010 +// Bug: g++ doesn't deal with overloads involving C-language fns properly. + +extern "C" double pow (double, double); +inline double pow (double d, int e) { return pow (d, (double) e); } + +void foo () +{ + pow (1.0, 1); + pow (1.0, 1.0); +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/loverload4.C b/gcc/testsuite/g++.old-deja/g++.jason/loverload4.C new file mode 100644 index 000000000..bdac76f4f --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/loverload4.C @@ -0,0 +1,8 @@ +// { dg-do assemble } +// Bug: g++ dies on this input. + +inline char abs (char x) { return 0; } + +extern "C" { + inline int abs (int x) { return 1; } +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/lvalue.C b/gcc/testsuite/g++.old-deja/g++.jason/lvalue.C new file mode 100644 index 000000000..643641eec --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/lvalue.C @@ -0,0 +1,22 @@ +// { dg-do assemble } +// Bug: Scoped method calls don't propagate the constness of `this'. +// PRMS Id: 4181 (second testcase) + +class D; + +class Bptr +{ +public: + Bptr& operator=(D*); + const Bptr& operator=(const D*) const; +}; + +class Dptr : public Bptr +{ +public: + const Dptr& operator=(const D* rep) const + { + Bptr::operator=(rep); + return *this; + } +}; diff --git a/gcc/testsuite/g++.old-deja/g++.jason/lvalue2.C b/gcc/testsuite/g++.old-deja/g++.jason/lvalue2.C new file mode 100644 index 000000000..35097f28f --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/lvalue2.C @@ -0,0 +1,20 @@ +// { dg-do assemble } +// PRMS Id: 4892 +// Bug: COND_EXPRs, MODIFY_EXPRs and COMPOUND_EXPRs aren't properly recognized +// as lvalues. + +extern int foo; +int& f (int& a, int& b) +{ + return (foo ? a : b); // { dg-bogus "" } +} + +int& g (int& a) +{ + return (a = 0); // { dg-bogus "" } +} + +int& h (int& a, int& b) +{ + return (a = 1, b); // { dg-bogus "" } +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/lvalue3.C b/gcc/testsuite/g++.old-deja/g++.jason/lvalue3.C new file mode 100644 index 000000000..c7f080393 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/lvalue3.C @@ -0,0 +1,9 @@ +// { dg-do assemble } +// Bug: C++ semantics for assignment don't match the backend semantics for +// MODIFY_EXPR. + +void +foo (int j) +{ + (j = 1)++; // causes compiler segfault +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/lvalue4.C b/gcc/testsuite/g++.old-deja/g++.jason/lvalue4.C new file mode 100644 index 000000000..0a2ab2205 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/lvalue4.C @@ -0,0 +1,7 @@ +// { dg-do run } +int main() { + int i = 2; + int *pi = &(++i); + + return i != 3; +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/mangle1.C b/gcc/testsuite/g++.old-deja/g++.jason/mangle1.C new file mode 100644 index 000000000..bcb1c87c6 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/mangle1.C @@ -0,0 +1,23 @@ +// { dg-do assemble } +// Bug: numeric_outputed_need_bar is not cleared properly, adding random '_'s +// to mangled names. + + +template +class rand1 +{ +public: + rand1 (); +}; + +class codes +{ +public: + rand1<32> * randgen; + codes (int ptr); + +}; + +codes::codes (int ptr) +{ +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/mangle2.C b/gcc/testsuite/g++.old-deja/g++.jason/mangle2.C new file mode 100644 index 000000000..c7957a24d --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/mangle2.C @@ -0,0 +1,23 @@ +// { dg-do assemble } +// I guess this was broken once. + +template class X { }; +typedef X T; + +class Y +{ + public: + ~Y(); +}; + +class Z +{ + public: + void f(T**); +}; + +void Z::f(T** t) +{ } + +Y::~Y() +{ } diff --git a/gcc/testsuite/g++.old-deja/g++.jason/mangle3.C b/gcc/testsuite/g++.old-deja/g++.jason/mangle3.C new file mode 100644 index 000000000..408a23753 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/mangle3.C @@ -0,0 +1,20 @@ +// { dg-do run } +// PRMS Id: 7563 +// Bug: declaration at function scope causes mismangling. + +int main() +{ + char ArrA[1][1][2][3], + ArrB[1][1][2][3]; + + void HitMe(char [1][1][2][3], char [1][1][2][3]); + + HitMe(ArrA, ArrB); + + return 0; +} + +void HitMe(char A[1][1][2][3], char B[1][1][2][3]) +{ + return; +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/member.C b/gcc/testsuite/g++.old-deja/g++.jason/member.C new file mode 100644 index 000000000..1abbdec1f --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/member.C @@ -0,0 +1,35 @@ +// { dg-do assemble } +// GROUPS passed member-pointers error-reporting +struct Y +{ + struct X + { + int A; + int Y::X::* foo () { undef1(1); return &Y::X::A; }// { dg-error "" } foo().* + int bar () { return A; } + }; +}; + +int Y::X::* foo () +{ + undef2(1);// { dg-error "" } foo().* + return &Y::X::A; +} + +int Y::X::* (* foo2 ())() +{ + undef3(1);// { dg-error "" } foo().* + return foo; +} + +int (Y::X::* bar2 ()) () +{ + undef4(1);// { dg-error "" } foo\(\).* + return Y::X::bar;// { dg-error "" } foo\(\).* +} + +int Y::X::* (Y::X::* foo3 ())() +{ + undef5(1);// { dg-error "" } foo().* + return Y::X::foo;// { dg-error "" } foo().* +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/method.C b/gcc/testsuite/g++.old-deja/g++.jason/method.C new file mode 100644 index 000000000..2de7b0c7b --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/method.C @@ -0,0 +1,12 @@ +// { dg-do assemble } +// Bug: pointer to pointer is treated as plain pointer. +// PRMS Id: 1767 + +class Foo { +public: + void method(); +}; + +void func(Foo ** ppFoo) { + ppFoo->method(); // { dg-error "" } +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/mi.C b/gcc/testsuite/g++.old-deja/g++.jason/mi.C new file mode 100644 index 000000000..40b6992d2 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/mi.C @@ -0,0 +1,17 @@ +// { dg-do run } +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; } }; + +int main () +{ + E* ep = new E; + + ep->foo(); + + return status; +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/mutable1.C b/gcc/testsuite/g++.old-deja/g++.jason/mutable1.C new file mode 100644 index 000000000..b6c146ad6 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/mutable1.C @@ -0,0 +1,12 @@ +// { dg-do run } +struct X +{ + X () { } + mutable int x; +}; + +int main () +{ + const X x; + x.x = 0; +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/nested1.C b/gcc/testsuite/g++.old-deja/g++.jason/nested1.C new file mode 100644 index 000000000..90c6ecb37 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/nested1.C @@ -0,0 +1,12 @@ +// { dg-do assemble } +// Bug: g++ can't deal with function-local classes that talk about themselves. + +void foo() { + class Wrapper { + public: + void F (void * Wrapperptr) + { + Wrapper * wrapptr = ( Wrapper *) Wrapperptr; // { dg-bogus "" } + } + }; +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/nested2.C b/gcc/testsuite/g++.old-deja/g++.jason/nested2.C new file mode 100644 index 000000000..af2d92b09 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/nested2.C @@ -0,0 +1,26 @@ +// { dg-do assemble } +// PRMS Id: 3764 (c/h) +// Bug: g++ gets into an infinite loop trying to find the top-level context + +class Menu; +class MenuItem; + +class MenuAction { +public: + virtual void execute (Menu& menu, MenuItem& menuItem) = 0; +protected: + MenuAction () {} +}; + +class Test { + class MenuCBA : public MenuAction { + public: + typedef void (Test::* MenuCBA_Member) (Menu& menu, MenuItem& menuItem); + MenuCBA (Test& instance, MenuCBA_Member member) + : _instance(&instance), _member(member) { } + void execute (Menu& menu, MenuItem& menuItem); + private: + MenuCBA_Member _member; + Test* _instance; + }; +}; diff --git a/gcc/testsuite/g++.old-deja/g++.jason/nested4.C b/gcc/testsuite/g++.old-deja/g++.jason/nested4.C new file mode 100644 index 000000000..02bf354e9 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/nested4.C @@ -0,0 +1,17 @@ +// { dg-do assemble } +// From: quipu@ulrik.uio.no +// Subject: extern "C" nested class +// Date: Fri, 13 Aug 1993 15:33:53 +0200 + +extern "C" { + struct A { + struct B { int j; } *x; + }; +} + +void +foo () { + A a; + struct A::B *b; + b = a.x; // { dg-bogus "" } type `B' is not a base type for type `B' +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/nested5.C b/gcc/testsuite/g++.old-deja/g++.jason/nested5.C new file mode 100644 index 000000000..8d6a5cf69 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/nested5.C @@ -0,0 +1,11 @@ +// { dg-do assemble } + +struct A { + struct B { }; +}; + +struct C : public A { + struct D + : public B // { dg-bogus "" } can't find B + { }; +}; diff --git a/gcc/testsuite/g++.old-deja/g++.jason/nested6.C b/gcc/testsuite/g++.old-deja/g++.jason/nested6.C new file mode 100644 index 000000000..289607838 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/nested6.C @@ -0,0 +1,5 @@ +// { dg-do assemble } +union A { + struct B { }; + A::B b; // { dg-bogus "" } +}; diff --git a/gcc/testsuite/g++.old-deja/g++.jason/nested7.C b/gcc/testsuite/g++.old-deja/g++.jason/nested7.C new file mode 100644 index 000000000..5dc16a977 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/nested7.C @@ -0,0 +1,16 @@ +// { dg-do assemble } +// Testcase for defining nested types separately. + +class remote +{ + class remote_file; +}; + +class remote::remote_file +{ +public: + ~remote_file(); +}; + +remote::remote_file::~remote_file() +{} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/nested8.C b/gcc/testsuite/g++.old-deja/g++.jason/nested8.C new file mode 100644 index 000000000..6c283fab4 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/nested8.C @@ -0,0 +1,8 @@ +// { dg-do assemble } + +struct A { }; +struct B: public A { + struct C { +friend struct B; // { dg-bogus "" } base clause w/o members + }; +}; diff --git a/gcc/testsuite/g++.old-deja/g++.jason/net.C b/gcc/testsuite/g++.old-deja/g++.jason/net.C new file mode 100644 index 000000000..1f5987d47 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/net.C @@ -0,0 +1,10 @@ +// { dg-do assemble } +// Bug: g++ doesn't instantiate function templates in instantiate_type. + +template void fn (T t) { } +template struct A { + void (*p)(T); + A() { p = fn; } +}; + +A a; diff --git a/gcc/testsuite/g++.old-deja/g++.jason/net2.C b/gcc/testsuite/g++.old-deja/g++.jason/net2.C new file mode 100644 index 000000000..ffb52d2b7 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/net2.C @@ -0,0 +1,38 @@ +// { dg-do run } +// Test of various ?: problems. + +class D +{ +public: + void a(); + void b(); + D(int i):x(i) {} +private: + int x; +}; + +void D::a() {++x;} +void D::b() {--x;} + + +int aa=1, bb=0; + +int fa() {return 0;} +int fb() {return 2;} + +int main(int argc, char* argv[]) +{ + typedef int* pi; + int* p = (argc == 1)? &aa: &bb; + *p = 0; + + typedef int (*ifptr)(); + ifptr fp = (argc == 1)? fa: fb; + aa = fp(); + + D d(0); + typedef void (D::*dmem)(); + dmem mfp = (argc == 1)? &D::a: &D::b; + (d.*mfp)(); + return 0; +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/new.C b/gcc/testsuite/g++.old-deja/g++.jason/new.C new file mode 100644 index 000000000..905739b1b --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/new.C @@ -0,0 +1,26 @@ +// { dg-do assemble } +// Bug: new doesn't make sure that the count is an integral value. + +#include +extern "C" int printf (const char *, ...); +extern "C" void *malloc (std::size_t); +std::size_t s; + +void * operator new (std::size_t siz) throw (std::bad_alloc) { + if (s == 0) + s = siz; + else + s = (s != siz); + return malloc (siz); +} + +int main() +{ + s = 0; + + float f = 3; + int* b1 = new int[(int)f]; + int* b2 = new int[f]; // { dg-error "" } new requires integral size + + return s; +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/new2.C b/gcc/testsuite/g++.old-deja/g++.jason/new2.C new file mode 100644 index 000000000..75d353da1 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/new2.C @@ -0,0 +1,13 @@ +// { dg-do run } +// { dg-options "-Wno-deprecated -fno-exceptions" } +// PRMS Id: 6267 + +struct A { + int i; + A() { i = 2; } +}; + +main() +{ + A *p = new A (); +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/new3.C b/gcc/testsuite/g++.old-deja/g++.jason/new3.C new file mode 100644 index 000000000..d950259e7 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/new3.C @@ -0,0 +1,38 @@ +// { dg-do run } +// { dg-options "-fcheck-new -pedantic -Wno-long-long" } +// PRMS Id: 6037 + +extern "C" void * malloc (__SIZE_TYPE__); + +int ena = 0; + +struct A { + int i; + A () { i = 2; } + void * operator new (__SIZE_TYPE__ s) + { + if (ena) + return 0; + return malloc (s); + } +}; + +struct B { + int i; + B () { i = 2; } + void * operator new (__SIZE_TYPE__ s) throw() + { + if (ena) + return 0; + return malloc (s); + } +}; + +int main () +{ + ena = 1; + A *ap = new A; + B *bp = new B; + + return ap || bp ; +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/new4.C b/gcc/testsuite/g++.old-deja/g++.jason/new4.C new file mode 100644 index 000000000..770a2a26f --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/new4.C @@ -0,0 +1,23 @@ +// { dg-do run } +// { dg-options "-fcheck-new" } + +struct A { + A(): i(42) { } + A(int j): i(j) { } + int i; +}; + +A* ap = new A (1); +A* ap2 = new A[3]; + +main () +{ + if (ap->i != 1 || ap2[0].i != 42 || ap2[1].i != 42 || ap2[2].i != 42) + return 1; + + A* ap = new A (1); + A* ap2 = new A[3]; + + if (ap->i != 1 || ap2[0].i != 42 || ap2[1].i != 42 || ap2[2].i != 42) + return 1; +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/new5.C b/gcc/testsuite/g++.old-deja/g++.jason/new5.C new file mode 100644 index 000000000..195df2d2f --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/new5.C @@ -0,0 +1,6 @@ +// { dg-do run } +int main () +{ + const int *p = new const int (0); + delete p; +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/offset1.C b/gcc/testsuite/g++.old-deja/g++.jason/offset1.C new file mode 100644 index 000000000..a918baab8 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/offset1.C @@ -0,0 +1,17 @@ +// { dg-do assemble } +// PRMS Id: 5070 (testcase 1) + +struct foo { + foo(int x = 0) {} + int IsAlive(void) { return 1; } +}; + +struct xx { + int IsOk(int X); + foo a; +}; + +int xx::IsOk(int X) +{ + return ((xx::a).IsAlive()); // { dg-bogus "" } +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/offset2.C b/gcc/testsuite/g++.old-deja/g++.jason/offset2.C new file mode 100644 index 000000000..80e37ad03 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/offset2.C @@ -0,0 +1,24 @@ +// { dg-do run } +// PRMS Id: 5070 (testcase 2) + +int status = 1; + +struct foo { + foo& operator= (const foo&) { status = 0; return *this; } +}; + +struct xx { + foo a; +}; + +struct yy : public xx { + yy(foo& a) { xx::a = a; } +}; + +int main() +{ + foo f; + yy y (f); + + return status; +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/offset3.C b/gcc/testsuite/g++.old-deja/g++.jason/offset3.C new file mode 100644 index 000000000..c419b2e11 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/offset3.C @@ -0,0 +1,22 @@ +// { dg-do assemble } +// PRMS Id: 5070 (bug 2) + +struct A { + void f (); +}; + +struct Ptr { + A* operator->(); +}; + +struct B { + Ptr p; +}; + +struct C: public B { + void g (); +}; + +void C::g() { + B::p->f(); // { dg-bogus "" } +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/offset4.C b/gcc/testsuite/g++.old-deja/g++.jason/offset4.C new file mode 100644 index 000000000..9325cc47c --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/offset4.C @@ -0,0 +1,15 @@ +// { dg-do assemble } +// Bug: g++ complains about the use of A::p below. + +struct A { + void *p; +}; + +struct B: public A { + int f () + { + if (A::p) + return 1; + return 0; + } +}; diff --git a/gcc/testsuite/g++.old-deja/g++.jason/opeq.C b/gcc/testsuite/g++.old-deja/g++.jason/opeq.C new file mode 100644 index 000000000..60fc5c1ae --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/opeq.C @@ -0,0 +1,40 @@ +// { dg-do run } +// PRMS Id: 4297 (related to 3525) +// Bug: Generating default op= didn't set TYPE_HAS_ASSIGNMENT, so it wasn't +// found. + +extern "C" int printf (const char *, ...); + +class Y +{ +public: + Y(const char*) {} + Y& operator = (const Y&) { return *this; } +}; + + +class X +{ +public: + X(int v, const char* m) : _v(v), _m (m) {} + X () : _v(0), _m("Unknown") {} + // Defining our own op= here makes things work correctly. + +private: + int _v; + int _m4; + // Adding more members here increases the count on u. + Y _m; +}; + +const X sPassed (1, "Passed"), sFailed (-1, "Failed"); + +int main (int, char**) +{ + X result; + int u = 0; + result = (u++ ? sPassed : sFailed); + if (u == 1) + return 0; + return 1; +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/opeq2.C b/gcc/testsuite/g++.old-deja/g++.jason/opeq2.C new file mode 100644 index 000000000..2d448a23c --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/opeq2.C @@ -0,0 +1,26 @@ +// { dg-do assemble } +// Bug: default operator= is not being generated properly. +// PRMS Id: 3525 + +struct ccUnwind +{ + ccUnwind& operator = (const ccUnwind&); +}; + +struct ccEllipseUnit +{ + ccEllipseUnit () {} +}; + +struct ccEllipse : ccUnwind +{ + ccEllipse (); + ccEllipse (const ccEllipseUnit&); + +}; + +void foo () +{ + ccEllipse e; + e = ccEllipseUnit(); // { dg-bogus "" } assignment not defined +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/opeq3.C b/gcc/testsuite/g++.old-deja/g++.jason/opeq3.C new file mode 100644 index 000000000..b4e6e2550 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/opeq3.C @@ -0,0 +1,15 @@ +// { dg-do assemble } +// Bug: g++ generates code for assignment in invalid situations. + +class X { // { dg-error "reference|operator=" } + int& a; +public: + X(int& i): a(i) { } +}; + +void foo () +{ + int one=1, two=2; + X a(one), b(two); + a = b; // { dg-message "synthesized|deleted" } +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/opeq4.C b/gcc/testsuite/g++.old-deja/g++.jason/opeq4.C new file mode 100644 index 000000000..37933f344 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/opeq4.C @@ -0,0 +1,8 @@ +// { dg-do assemble } +// PRMS Id: 4329 +// Bug: default op= gives an warning about casting away volatile. + +struct foo +{ + volatile int bar[2]; +}; diff --git a/gcc/testsuite/g++.old-deja/g++.jason/opeq5.C b/gcc/testsuite/g++.old-deja/g++.jason/opeq5.C new file mode 100644 index 000000000..a2590efcf --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/opeq5.C @@ -0,0 +1,27 @@ +// { dg-do run } +// Testcase for tricky synthesized op= in complex inheritance situation. +// This used to test whether the virtual base was copy-assigned only once. +// That feature is not required by ISO C++, so the test now only checks +// whether the vbase is assigned at all. + +int count = 0; +extern "C" int printf (const char *, ...); + +class A { + public: + A& operator = (const A&) { count++; return *this; } +}; + +class B: virtual private A { }; +class C: virtual public A { }; +class D: public B, public C { }; + +int main() +{ + D a, b; + a = b; + printf ("%d\n",count); + if (count == 0) + return 1; + return 0; +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/opeq6.C b/gcc/testsuite/g++.old-deja/g++.jason/opeq6.C new file mode 100644 index 000000000..ead4797a3 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/opeq6.C @@ -0,0 +1,24 @@ +// { dg-do assemble } +// Testcase for wrongful generation of operator =. + +class ivResource { +public: + ivResource (); +private: + ivResource & operator =(const ivResource &); +}; + +class ivButtonState : virtual public ivResource { +public: + void operator=(ivButtonState &); +}; + +class ivPrintBS : public ivButtonState { +}; + +void f () +{ + ivPrintBS a, b; + a = b; +} + diff --git a/gcc/testsuite/g++.old-deja/g++.jason/operator.C b/gcc/testsuite/g++.old-deja/g++.jason/operator.C new file mode 100644 index 000000000..780315771 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/operator.C @@ -0,0 +1,32 @@ +// { dg-do assemble } +// { dg-options "" } +// General test for operator overloading permissiveness. + +typedef __SIZE_TYPE__ size_t; + +struct A { + int operator?:(int a, int b); // { dg-error "expected type-specifier" } + static int operator()(int a); // { dg-error "must be a nonstatic member" } + static int operator+(A,A); // { dg-error "either a non-static member" } + int operator+(int a, int b = 1); // { dg-error "either zero or one" } + int operator++(char); // { dg-error "must take 'int'" } + void operator delete (void *); + void operator delete (void *, unsigned long); +}; + +struct B { + void * operator new (size_t, void *); + int operator++(int = 0); + int operator+ (int); + void operator()(); + char * operator[](int); + B * operator->(); +}; + +int operator-(int a, int b); // { dg-error "argument of class or" } + +void * operator new (A a); // { dg-error "first parameter" } +void operator delete (A a); // { dg-error "first parameter" } + +char * operator char * (int); // { dg-error "return type" "ret" } +// { dg-error "nonstatic member function" "mem" { target *-*-* } 31 } diff --git a/gcc/testsuite/g++.old-deja/g++.jason/operator2.C b/gcc/testsuite/g++.old-deja/g++.jason/operator2.C new file mode 100644 index 000000000..892ed3f1d --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/operator2.C @@ -0,0 +1,14 @@ +// { dg-do assemble } +// PRMS Id: 6018 + +class string { + char *p; +public: + string(const char* s) ;// { p == s; } + operator const char*() ;// { return s; } +}; + +void f4(string& s) +{ + *s; // implies "s.operator const char*()" +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/opover.C b/gcc/testsuite/g++.old-deja/g++.jason/opover.C new file mode 100644 index 000000000..3ec833e2e --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/opover.C @@ -0,0 +1,15 @@ +// { dg-do assemble } +// Bug: g++ prefers a non-matching operator== over user-defined conversions +// and a default operator==. + +struct A { + operator int (); +}; + +struct B { + friend int operator== (B, int); +}; + +int foo (A& a) { + return a == 1; +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/optimize.C b/gcc/testsuite/g++.old-deja/g++.jason/optimize.C new file mode 100644 index 000000000..4676bef36 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/optimize.C @@ -0,0 +1,42 @@ +// { dg-do assemble } +// { dg-options "-O -pedantic-errors" } +// Bug: g++ claims that control can fall off the end of these functions. +// PRMS Id: 4943 + +struct A { + A(); + A(const A&); + A& operator= (const A&); + ~A(); +}; + +int f () +{ + A a[2]; + return 1; +} // { dg-bogus "" } jump_optimize + +int g () +{ + A a; + return 1; +} // { dg-bogus "" } jump_optimize + +struct B { + B(); + B(const B&); + B& operator= (const B&); + ~B(); +}; + +inline B::~B() +{ + int i = 2; + while (i--) ; +} + +int h () +{ + B b; + return 1; +} // { dg-bogus "" } jump_optimize diff --git a/gcc/testsuite/g++.old-deja/g++.jason/optimize2.C b/gcc/testsuite/g++.old-deja/g++.jason/optimize2.C new file mode 100644 index 000000000..58b3b127f --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/optimize2.C @@ -0,0 +1,22 @@ +// { dg-do run } +// { dg-options "-w" } +// Used to crash on the alpha with optimization. + +extern "C" void abort (void); + +struct Fix { + unsigned short l; +}; + +static inline void f (int len) +{ + if (len > 65535) + abort (); +} + +struct Fix a = { 33 }; + +main() +{ + f (a.l); +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/overload.C b/gcc/testsuite/g++.old-deja/g++.jason/overload.C new file mode 100644 index 000000000..6a747ff96 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/overload.C @@ -0,0 +1,20 @@ +// { dg-do assemble } +// GROUPS passed overloading +enum bar {}; + +void operator+ (int, int);// { dg-error "" } .* +void operator+ (bar&, int); + +template void operator+ (int b, T& t) { return b; } +void operator+ (int, bar&); + +template class foo +{ +public: + friend void operator+ <> (int, T&); +}; + +class baz; + +class foo; +class foo; diff --git a/gcc/testsuite/g++.old-deja/g++.jason/overload1.C b/gcc/testsuite/g++.old-deja/g++.jason/overload1.C new file mode 100644 index 000000000..36f9cac46 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/overload1.C @@ -0,0 +1,12 @@ +// { dg-do assemble } +// Bug: g++ thinks there is a conversion from void * to B *. + +struct A { + operator void* (); +}; + +struct B: public A { }; + +void bar (A& a) { + B* bp = (B*)a; // { dg-error "" } +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/overload11.C b/gcc/testsuite/g++.old-deja/g++.jason/overload11.C new file mode 100644 index 000000000..3fe871918 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/overload11.C @@ -0,0 +1,18 @@ +// { dg-do run } +// 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; } +}; + +int main() +{ + A a; + const A& b = a; + int i = 2; + b.foo (i); + return i; +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/overload12.C b/gcc/testsuite/g++.old-deja/g++.jason/overload12.C new file mode 100644 index 000000000..b6ff7e167 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/overload12.C @@ -0,0 +1,16 @@ +// { dg-do run } +// 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_; } + +int main() +{ + return b().foo(); +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/overload13.C b/gcc/testsuite/g++.old-deja/g++.jason/overload13.C new file mode 100644 index 000000000..74205c1b0 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/overload13.C @@ -0,0 +1,28 @@ +// { dg-do run } +// 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; +} + +int main() { + int i; + xifstream ifs; + + ifs >> i; +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/overload14.C b/gcc/testsuite/g++.old-deja/g++.jason/overload14.C new file mode 100644 index 000000000..a4c6cff8a --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/overload14.C @@ -0,0 +1,10 @@ +// { dg-do assemble } +// Bug: g++ fails to recognize that the template matches the target type. + +template void foo (T *, int); + +struct A; +void bar () +{ + void (*p)(A *, int) = &foo; +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/overload15.C b/gcc/testsuite/g++.old-deja/g++.jason/overload15.C new file mode 100644 index 000000000..fdd692b09 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/overload15.C @@ -0,0 +1,10 @@ +// { dg-do assemble } +// Bug: g++ thinks that int->long is a promotion. + +long f (long, long); +double f (double, double); + +void g (double d) +{ + f (d, 0); +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/overload16.C b/gcc/testsuite/g++.old-deja/g++.jason/overload16.C new file mode 100644 index 000000000..fba33eda7 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/overload16.C @@ -0,0 +1,8 @@ +// { dg-do assemble } +void f (int); // { dg-message "note" } +void f (long); // { dg-message "note" } +int main() +{ + f (1 & 0xffffff00UL); // { dg-error "ambiguous" } + // { dg-message "candidate" "candidate note" { target *-*-* } 6 } +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/overload17.C b/gcc/testsuite/g++.old-deja/g++.jason/overload17.C new file mode 100644 index 000000000..df47ed44e --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/overload17.C @@ -0,0 +1,20 @@ +// { dg-do assemble } +// Bug: g++ fails to prefer UDC's alone to UDC's plus standard conversions. + +struct B { }; +struct D: public B { }; +struct DP { + operator D * () const; + operator double () const; +}; + +void f (B *); +void f (D *); +void g (double); +void g (float); + +void h (DP p) +{ + f (p); + g (p); +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/overload18.C b/gcc/testsuite/g++.old-deja/g++.jason/overload18.C new file mode 100644 index 000000000..3fb979915 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/overload18.C @@ -0,0 +1,6 @@ +// { dg-do assemble } +// pushdecl gets confused by this. + +void f (); +void f (int, int); +template T f (T) { } diff --git a/gcc/testsuite/g++.old-deja/g++.jason/overload19.C b/gcc/testsuite/g++.old-deja/g++.jason/overload19.C new file mode 100644 index 000000000..73404fe9d --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/overload19.C @@ -0,0 +1,12 @@ +// { dg-do run } +// PRMS Id: 4689 +// Bug: g++ doesn't notice operators overloaded on enumeral types. + +enum E { A=5, B=32, C=100 }; + +E operator|(E a, E b) { return C; } + +int main() +{ + return (A|B) != C; +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/overload2.C b/gcc/testsuite/g++.old-deja/g++.jason/overload2.C new file mode 100644 index 000000000..631f953cf --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/overload2.C @@ -0,0 +1,12 @@ +// { dg-do assemble } +// Bug: foo and bar are considered to be overloaded (i.e. their +// IDENTIFIER_GLOBAL_VALUES are TREE_LISTs) even though they aren't, +// so ?: thinks it can't resolve the names. + +void foo (); +void bar (); + +void baz () +{ + void (*p)() = 1 ? foo : bar; // { dg-bogus "" } wrongful overloading +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/overload20.C b/gcc/testsuite/g++.old-deja/g++.jason/overload20.C new file mode 100644 index 000000000..f5db6a20f --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/overload20.C @@ -0,0 +1,12 @@ +// { dg-do assemble } +// Bug: this code causes an internal compiler error 4. + +void f (char *); +void f (int); +struct A { + void f (); // { dg-error "" } candidate + void f (int); // { dg-error "" } candidate + void g () { + void (*p)(char *) = f; // { dg-error "" } no matching function in scope + } +}; diff --git a/gcc/testsuite/g++.old-deja/g++.jason/overload21.C b/gcc/testsuite/g++.old-deja/g++.jason/overload21.C new file mode 100644 index 000000000..229be93da --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/overload21.C @@ -0,0 +1,13 @@ +// { dg-do assemble } +struct X { + void f (int = 4, char = 'r'); // { dg-error "previous specification" } + void g (int = 4, char = 'r'); // { dg-error "previous specification" } +}; + +void +X::f (int i = 4, char x = 'r') // { dg-error "default argument" } +{ } + +void +X::g (int i = 9, char x = 's') // { dg-error "default argument" } +{ } diff --git a/gcc/testsuite/g++.old-deja/g++.jason/overload22.C b/gcc/testsuite/g++.old-deja/g++.jason/overload22.C new file mode 100644 index 000000000..da0a8a63a --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/overload22.C @@ -0,0 +1,17 @@ +// { dg-do assemble } +// PRMS Id: 4574 +// Bug: g++ prefers int to double for float& argument + +inline double abs (double x) { return x;} +inline int abs (int i) { return i; } + +float& fn(float& f) +{ + return f; +} + +void foo() +{ + float f = 23.45; + abs(fn(f)); // gets bogus warning +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/overload23.C b/gcc/testsuite/g++.old-deja/g++.jason/overload23.C new file mode 100644 index 000000000..fe605f037 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/overload23.C @@ -0,0 +1,27 @@ +// { dg-do assemble } +// From: panisset@cae.ca (Jean-Francois Panisset) +// Date: Mon, 6 Jun 94 13:39:25 EDT +// Subject: Problem with operator overloading + + +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); + + +int main() +{ + X x; + ostream os; + os << x; // { dg-bogus "" } converting to float +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/overload24.C b/gcc/testsuite/g++.old-deja/g++.jason/overload24.C new file mode 100644 index 000000000..3aee9b360 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/overload24.C @@ -0,0 +1,23 @@ +// { dg-do assemble } +// PRMS Id: 5124 +// Bug: g++ promotes bar to int* too soon and the call to f fails. + +typedef int arr[1]; + +struct A { + void f(void); + void f(arr &); + + void g(void); + void g(int *); + + void h(void); +}; + + +void A::h(void) +{ + arr bar; + f(bar); + g(bar); +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/overload26.C b/gcc/testsuite/g++.old-deja/g++.jason/overload26.C new file mode 100644 index 000000000..681473f26 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/overload26.C @@ -0,0 +1,22 @@ +// { dg-do assemble } +// Bug: g++ tries to build up a mangled name for its ideal match, which +// fails for one call below. + +extern const char foo[]; +extern const char baz[10]; +extern const char *fred; + +struct A { + void f(const char *); +} *a; + +void bing(const char *); +int main () +{ + a->f(foo); // { dg-bogus "" } because foo's size unknown. + a->f(baz); + a->f(fred); + bing(fred); + bing(foo); + bing(baz); +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/overload27.C b/gcc/testsuite/g++.old-deja/g++.jason/overload27.C new file mode 100644 index 000000000..4fd11752d --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/overload27.C @@ -0,0 +1,8 @@ +// { dg-do run } +void f(const int &) { } +void f(const float &); + +int main() +{ + f(false); // { dg-bogus "" } +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/overload28.C b/gcc/testsuite/g++.old-deja/g++.jason/overload28.C new file mode 100644 index 000000000..fe0dae103 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/overload28.C @@ -0,0 +1,13 @@ +// { dg-do assemble } +// PRMS Id: 6056 + +struct Foo { + Foo() { } // { dg-message "note" } + Foo(int i = 25) { } // { dg-message "note" } +}; + +int main() +{ + Foo* f1 = new Foo(); // { dg-error "ambiguous" } + // { dg-message "candidate" "candidate note" { target *-*-* } 11 } +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/overload29.C b/gcc/testsuite/g++.old-deja/g++.jason/overload29.C new file mode 100644 index 000000000..abc4418bd --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/overload29.C @@ -0,0 +1,16 @@ +// { dg-do assemble } +// Bug: we get an error trying to build up our ideal candidate. + +class C { + public: + C( const char * ); +}; + + extern const char c1[]; + +void f2( const char * ); + +void f1() { + C *fntp = new C(c1); // Line 10 + f2( c1 ); +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/overload3.C b/gcc/testsuite/g++.old-deja/g++.jason/overload3.C new file mode 100644 index 000000000..3cca3147e --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/overload3.C @@ -0,0 +1,12 @@ +// { dg-do assemble } +// Bug: bar is considered to be overloaded (i.e. its +// IDENTIFIER_GLOBAL_VALUES are TREE_LISTs) even though it isn't, +// so default_conversion thinks it can't resolve the name. + +void foo (); +void bar (); + +void baz () +{ + void (*p)() = 1 ? (void (*)()) &foo : bar; +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/overload30.C b/gcc/testsuite/g++.old-deja/g++.jason/overload30.C new file mode 100644 index 000000000..9f65080eb --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/overload30.C @@ -0,0 +1,17 @@ +// { dg-do assemble } +// PRMS Id: 6412 + +class Foo; + +template +class Temp +{ + F func_; +public: + Temp (F f) : func_(f) {} +}; + +template +T* func1 (T* t) { return t; } + +Temp temp2(func1); diff --git a/gcc/testsuite/g++.old-deja/g++.jason/overload31.C b/gcc/testsuite/g++.old-deja/g++.jason/overload31.C new file mode 100644 index 000000000..18dc213a5 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/overload31.C @@ -0,0 +1,24 @@ +// { dg-do assemble } +// PRMS Id: 6568 +// Bug: g++ complains about the ambiguous conversion to bool even though +// we wouldn't end up using it anyway. + +class AString +{ +public: + AString (unsigned len); + operator char *() const; + operator char const *() const; +}; + +void +foo(unsigned t, AString const & handle) +{ +} + +void +foo(AString const & handle, bool includeSpecials) +{ + unsigned t; + foo(t, handle); +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/overload32.C b/gcc/testsuite/g++.old-deja/g++.jason/overload32.C new file mode 100644 index 000000000..1a81ef692 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/overload32.C @@ -0,0 +1,19 @@ +// { dg-do assemble } +// PRMS Id: 7128 + +class B {}; + +class D : public B {}; + +class X { + public: + operator const B & () const; + operator const D & () const; +}; + +void f( const D & ); + +void g( const X & x ) +{ + f( x ); +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/overload33.C b/gcc/testsuite/g++.old-deja/g++.jason/overload33.C new file mode 100644 index 000000000..2cc34c6b2 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/overload33.C @@ -0,0 +1,78 @@ +// { dg-do assemble } +// PRMS ID: 7507 + +/* ------------------------------------------------------------ */ + +class Base0 +{ +public: + Base0() {} + virtual ~Base0() {} +}; + +class Base1 +{ +public: + Base1() {} + virtual ~Base1() {} +}; + +class Derived : public Base0, public Base1 +{ +public: + Derived() {} + virtual ~Derived() {} +}; + +/* ------------------------------------------------------------ */ + +class Dummy +{ + public: + Dummy(Base0 * theBase) {} + ~Dummy() {} +}; + +/* ------------------------------------------------------------ */ + +template +class ConstSmartPtr +{ + T* myItem; // private + + public: + ConstSmartPtr(T const* theItem); + + operator T const*() const + { return myItem; } + protected: + T* _item() const + { return myItem; } +}; + +template +class SmartPtr : public ConstSmartPtr +{ + public: + SmartPtr(T* theItem) + : ConstSmartPtr(theItem) {} + + T* item() const + { return this->_item(); } + + operator T*() const + { return this->_item(); } +}; + +/* ------------------------------------------------------------ */ + +void +function() +{ + SmartPtr myObj = new Derived(); + + Dummy th1(myObj); // Doesn't work under Cygnus + Dummy th2((Base0 *) myObj); // Doesn't work either +} + +/* ------------------------------------------------------------ */ diff --git a/gcc/testsuite/g++.old-deja/g++.jason/overload34.C b/gcc/testsuite/g++.old-deja/g++.jason/overload34.C new file mode 100644 index 000000000..13c3eedcf --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/overload34.C @@ -0,0 +1,8 @@ +// { dg-do assemble } +// PRMS ID: 8010 + +class X { + int & flag; +public: + void f(){ flag++ ; } +}; diff --git a/gcc/testsuite/g++.old-deja/g++.jason/overload35.C b/gcc/testsuite/g++.old-deja/g++.jason/overload35.C new file mode 100644 index 000000000..7c7db75ca --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/overload35.C @@ -0,0 +1,25 @@ +// { dg-do assemble } +// PRMS Id: 9647 + +class castBug +{ +public: + operator int *(); + operator const int *() const; +}; + +class castBug2 +{ +public: + operator const int *() const; +}; + +void voidfn(void *); + +void test() +{ + castBug b; + castBug2 b2; + voidfn(b); // { dg-bogus "" } + voidfn(b2); // { dg-error "" } discarding const +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/overload36.C b/gcc/testsuite/g++.old-deja/g++.jason/overload36.C new file mode 100644 index 000000000..324d766ea --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/overload36.C @@ -0,0 +1,16 @@ +// { dg-do run } +// Test for subsequence checking in overload resolution. + +class foo { +public: + void operator <<(char *) { } + void operator <<(const char * const &); +}; + +int +main() +{ + char s[20]; + foo f; + f << s; +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/overload4.C b/gcc/testsuite/g++.old-deja/g++.jason/overload4.C new file mode 100644 index 000000000..6a30b435d --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/overload4.C @@ -0,0 +1,11 @@ +// { dg-do assemble } +// Testcase for simple overloading resolution. + +void foo (int); +void foo (int, int); + +void bar () +{ + foo (1); + foo (1, 2); +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/overload5.C b/gcc/testsuite/g++.old-deja/g++.jason/overload5.C new file mode 100644 index 000000000..9280c9d5e --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/overload5.C @@ -0,0 +1,5 @@ +// { dg-do assemble } +// Testcase for simple overloading resolution. + +int foo (); // { dg-error "" } +void foo (); // { dg-error "" } disallowed overload diff --git a/gcc/testsuite/g++.old-deja/g++.jason/overload6.C b/gcc/testsuite/g++.old-deja/g++.jason/overload6.C new file mode 100644 index 000000000..765c20d38 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/overload6.C @@ -0,0 +1,15 @@ +// { dg-do assemble } +// Bug: g++ thinks there is a default conversion from void* to B*. +// There isn't. + +struct A { + operator void* (); +}; + +struct B { }; + +void foo (B* bp); + +void bar (A& a) { + foo (a); // { dg-error "" } +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/overload7.C b/gcc/testsuite/g++.old-deja/g++.jason/overload7.C new file mode 100644 index 000000000..2dc3b031a --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/overload7.C @@ -0,0 +1,15 @@ +// { dg-do assemble } +// Bug: g++ thinks there is a default conversion from A& to B*. +// There isn't. + +struct A { + operator A* (); +}; + +struct B: public A { }; + +void foo (B* bp); + +void bar (A& a) { + foo (a); // { dg-error "" } +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/overload8.C b/gcc/testsuite/g++.old-deja/g++.jason/overload8.C new file mode 100644 index 000000000..2987ae51a --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/overload8.C @@ -0,0 +1,7 @@ +// { dg-do assemble } +// Bug: g++ fails to catch the ambiguity below. + +struct A { + operator int () { return 1; } + operator int &() { return 1; } // { dg-error "" } +}; diff --git a/gcc/testsuite/g++.old-deja/g++.jason/overload9.C b/gcc/testsuite/g++.old-deja/g++.jason/overload9.C new file mode 100644 index 000000000..c6930a2af --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/overload9.C @@ -0,0 +1,39 @@ +// { dg-do assemble } +// PRMS Id: 4257 +// Bug: g++ ignores non-member possibilities (ideal_candidate_ansi bug) + +class ostream +{ +public: +#ifdef EITHER_ONE_A + ostream& operator<<(unsigned long n); + ostream& operator<<(long n); +#else + ostream& operator<<(short n); + ostream& operator<<(unsigned short n); +#endif +}; + +class ccObjectInfo {}; + +ostream& operator << (ostream& out, const ccObjectInfo& obj); + +class ccString : public ccObjectInfo +{ +#ifdef EITHER_ONE_B + operator int () const; +#else + operator long () const; +#endif +}; + +// Should pick this one!! +ostream& operator << (ostream& o, const ccString & s); + +extern ostream cout; + +void f () +{ + ccString foo; + cout << foo; +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/parse1.C b/gcc/testsuite/g++.old-deja/g++.jason/parse1.C new file mode 100644 index 000000000..9d06b0552 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/parse1.C @@ -0,0 +1,8 @@ +// { dg-do assemble } +// Bug: g++ parses the declaration of r as a function declaration. + +void foo (int i) +{ + int &r (i); + r = 1; // { dg-bogus "" } +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/parse10.C b/gcc/testsuite/g++.old-deja/g++.jason/parse10.C new file mode 100644 index 000000000..751928a2b --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/parse10.C @@ -0,0 +1,16 @@ +// { dg-do run } +// Testcase for precedence of ?: wrt = + +extern "C" int printf (const char *, ...); + +int 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; +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/parse11.C b/gcc/testsuite/g++.old-deja/g++.jason/parse11.C new file mode 100644 index 000000000..40864c108 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/parse11.C @@ -0,0 +1,9 @@ +// { dg-do assemble } +// PRMS Id: 6825 + +class aClass +{ + ; // { dg-error "" } missing declaration +private: + ; // { dg-error "" } missing declaration +}; diff --git a/gcc/testsuite/g++.old-deja/g++.jason/parse12.C b/gcc/testsuite/g++.old-deja/g++.jason/parse12.C new file mode 100644 index 000000000..8988cebc8 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/parse12.C @@ -0,0 +1,18 @@ +// { dg-do run } +// PRMS Id: 6821 + +struct A { + int operator()(int i) { return i; } +}; + +struct B { + A* p; + int f () { return (*p)(42); } // { dg-bogus "" } +}; + +int main () +{ + B b = { new A }; + + return b.f () != 42; +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/parse13.C b/gcc/testsuite/g++.old-deja/g++.jason/parse13.C new file mode 100644 index 000000000..e438ee297 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/parse13.C @@ -0,0 +1,8 @@ +// { dg-do assemble } + +struct A { + struct B {}; + struct C; +}; + +struct A :: C : A :: B {}; // { dg-bogus "" } parse error before `:' diff --git a/gcc/testsuite/g++.old-deja/g++.jason/parse14.C b/gcc/testsuite/g++.old-deja/g++.jason/parse14.C new file mode 100644 index 000000000..34b5f8400 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/parse14.C @@ -0,0 +1,12 @@ +// { dg-do assemble } +// Bug: g++ decides that A::foo is introducing a constructor declarator. + +struct A { + typedef bool foo; +}; + +A::foo (*bar) (); + +struct B { + A::foo (*bar) (); +}; diff --git a/gcc/testsuite/g++.old-deja/g++.jason/parse2.C b/gcc/testsuite/g++.old-deja/g++.jason/parse2.C new file mode 100644 index 000000000..e33ffa6f1 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/parse2.C @@ -0,0 +1,6 @@ +// { dg-do assemble } +// Bug: g++ doesn't understand constructor syntax for pointers. + +void f () { + char * p (0); +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/parse3.C b/gcc/testsuite/g++.old-deja/g++.jason/parse3.C new file mode 100644 index 000000000..bed74f47b --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/parse3.C @@ -0,0 +1,6 @@ +// { dg-do assemble } +// PRMS Id: 4484 (bug 2) +// Bug: g++ does not grok abstract declarator syntax for method pointers. + +template class A { }; +void (A::*p)() = (void (A::*)())0; // { dg-bogus "" } abstract declarator failure diff --git a/gcc/testsuite/g++.old-deja/g++.jason/parse4.C b/gcc/testsuite/g++.old-deja/g++.jason/parse4.C new file mode 100644 index 000000000..13722227a --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/parse4.C @@ -0,0 +1,7 @@ +// { dg-do assemble } +// Bug: g++ doesn't handle superfluous parentheses when redeclaring a TYPENAME. + +typedef int foo; +class A { + typedef int ((foo)); // { dg-bogus "" } +}; diff --git a/gcc/testsuite/g++.old-deja/g++.jason/parse5.C b/gcc/testsuite/g++.old-deja/g++.jason/parse5.C new file mode 100644 index 000000000..251db3d56 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/parse5.C @@ -0,0 +1,12 @@ +// { dg-do assemble } +// Bug: foo (bar) should be a declaration of a static data member, not a +// function; it's getting caught by the rules for constructors. + +typedef int foo; +typedef int bar; +struct A { + static foo (bar); // { dg-bogus "" } +}; + +int i = A::bar; // { dg-bogus "" } +int (*fp)(bar) = A::foo; // { dg-error "" } diff --git a/gcc/testsuite/g++.old-deja/g++.jason/parse6.C b/gcc/testsuite/g++.old-deja/g++.jason/parse6.C new file mode 100644 index 000000000..ba37f103e --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/parse6.C @@ -0,0 +1,9 @@ +// { dg-do assemble } +// PRMS id: 4653 +// Bug: g++ tries to resolve declarator/expression ambiguities too soon. + +template struct A { }; + +void f () { + void (A::*pmf) (); // { dg-bogus "" } late binding +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/parse7.C b/gcc/testsuite/g++.old-deja/g++.jason/parse7.C new file mode 100644 index 000000000..40b22877c --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/parse7.C @@ -0,0 +1,7 @@ +// { dg-do assemble } +// Bug: g++ tries to parse this as a constructor. + +typedef int foo; +struct A { + foo (*bar)(); +}; diff --git a/gcc/testsuite/g++.old-deja/g++.jason/parse8.C b/gcc/testsuite/g++.old-deja/g++.jason/parse8.C new file mode 100644 index 000000000..a03dd184a --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/parse8.C @@ -0,0 +1,2 @@ +// { dg-do assemble } +void foo(const int* const); // { dg-bogus "" } diff --git a/gcc/testsuite/g++.old-deja/g++.jason/parse9.C b/gcc/testsuite/g++.old-deja/g++.jason/parse9.C new file mode 100644 index 000000000..5fa46391f --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/parse9.C @@ -0,0 +1,19 @@ +// { dg-do run } +// 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() { } +}; + +int main(int argc, char * argv[]) +{ + int * i = &argc; + + Fu((*i)).print(); // { dg-bogus "" } + Fu((*j)); +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/pmem.C b/gcc/testsuite/g++.old-deja/g++.jason/pmem.C new file mode 100644 index 000000000..90c612263 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/pmem.C @@ -0,0 +1,11 @@ +// { dg-do assemble } +// Bug: g++ parses the declaration of 'char A::* foo' below as a +// declaration of 'char A'. + +class A { }; +typedef int foo; +void f () +{ + char A::* foo; + foo = 0; // { dg-bogus "" } parsing blunder +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/pmem2.C b/gcc/testsuite/g++.old-deja/g++.jason/pmem2.C new file mode 100644 index 000000000..03205345d --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/pmem2.C @@ -0,0 +1,44 @@ +// { dg-do run } +template +class aCallback +{ +public: + aCallback(Called& obj, int (Called::*met)()); + + int callback(); + +protected: + +private: + Called& object; + + int (Called::*method)(); + +}; + +template +aCallback::aCallback(Called& obj, + int (Called::*met)()) : +object(obj), +method(met) +{} + +template +int aCallback::callback() +{ + return (object.*method)(); +} + +struct myStruct +{ + int action() {return 0;} +}; + +int main() +{ + myStruct toto; + + aCallback cb(toto, &myStruct::action); + + return cb.callback(); +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/pmem3.C b/gcc/testsuite/g++.old-deja/g++.jason/pmem3.C new file mode 100644 index 000000000..1476266f6 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/pmem3.C @@ -0,0 +1,12 @@ +// { dg-do run } +// 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 (); }; +int main () +{ + int A::*apm = &A::i; + int B::*bpm = apm; + return apm != bpm; +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/pmem4.C b/gcc/testsuite/g++.old-deja/g++.jason/pmem4.C new file mode 100644 index 000000000..b05c86d4f --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/pmem4.C @@ -0,0 +1,11 @@ +// { dg-do assemble } +struct X {}; +X& X::*PTM_1; // { dg-error "" } pointer to reference member +void X::*PTM_2; // { dg-error "" } pointer to void member + +struct A { + static int& ir; +}; + +int i; +int& A::ir = i; // not an error diff --git a/gcc/testsuite/g++.old-deja/g++.jason/pmf.C b/gcc/testsuite/g++.old-deja/g++.jason/pmf.C new file mode 100644 index 000000000..b601dd9ff --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/pmf.C @@ -0,0 +1,7 @@ +// { dg-do assemble } +// PRMS Id: 4333 +// Bug: g++ can't deal with casts to pointer to member function. + +class A { }; +typedef void (A::* pmf)(); +void foo () { (pmf) 0; } diff --git a/gcc/testsuite/g++.old-deja/g++.jason/pmf2.C b/gcc/testsuite/g++.old-deja/g++.jason/pmf2.C new file mode 100644 index 000000000..30a3aab19 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/pmf2.C @@ -0,0 +1,13 @@ +// { dg-do assemble } +// PRMS Id: 4484 (bug 3) +// Bug: g++ does implicitly take the address of methods passed to fns. + +struct A { + void f (); +}; + +void g (void (A::*)()); + +void h () { + g (A::f); // { dg-error "" } failed conversion to method pointer +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/pmf3.C b/gcc/testsuite/g++.old-deja/g++.jason/pmf3.C new file mode 100644 index 000000000..636ac5d34 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/pmf3.C @@ -0,0 +1,19 @@ +// { dg-do assemble } +// From: enewton@uunet.uu.NET +// Subject: g++ 2.5.8: cannot cast member function pointers +// Date: 27 Jan 1994 01:22:56 -0500 + +struct A { + void f(char); + void g(int); +}; + +typedef void (A::*Ptr)(char); + +void q() { + Ptr p; + + p = (Ptr) &A::f; + p = (Ptr) &A::g; + p = &A::f; +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/pmf4.C b/gcc/testsuite/g++.old-deja/g++.jason/pmf4.C new file mode 100644 index 000000000..709532e8f --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/pmf4.C @@ -0,0 +1,9 @@ +// { dg-do assemble } +// PRMS Id: 4484 (bug 5) +// Bug: g++ can't convert between pmf types. + +class A; +typedef void (A::*pmf)(); +typedef void (A::*pmfc)() const; + +pmfc p = (pmfc)(pmf)0; // { dg-bogus "" } pmf conversion diff --git a/gcc/testsuite/g++.old-deja/g++.jason/pmf5.C b/gcc/testsuite/g++.old-deja/g++.jason/pmf5.C new file mode 100644 index 000000000..26fa9432a --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/pmf5.C @@ -0,0 +1,19 @@ +// { dg-do assemble } +// { dg-options "" } +// PRMS Id: 4985 + +struct Thing { + int OverloadFn() const; + void FunctionA(char* restOfLine); + void OverloadFn(char* restOfLine); +}; + +struct ThingEntry { + void (Thing::*_handler)(char* restOfLine); +}; + +static ThingEntry KeyWordTable[] = { + &Thing::FunctionA, + Thing::OverloadFn, +}; // { dg-error "assuming" "assuming" } implicit & +// { dg-message "note" "note" { target *-*-* } 18 } diff --git a/gcc/testsuite/g++.old-deja/g++.jason/pmf6.C b/gcc/testsuite/g++.old-deja/g++.jason/pmf6.C new file mode 100644 index 000000000..13c0981f9 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/pmf6.C @@ -0,0 +1,11 @@ +// { dg-do assemble } +// PRMS Id: 5656 +// Bug: g++ tries (which is a bug) and fails (which is a bug) to initialize +// var at runtime. + +struct A +{ + int func(int); + int func() const; +}; +int (A::* var) () const = & A::func; diff --git a/gcc/testsuite/g++.old-deja/g++.jason/pmf7.C b/gcc/testsuite/g++.old-deja/g++.jason/pmf7.C new file mode 100644 index 000000000..760133384 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/pmf7.C @@ -0,0 +1,28 @@ +// { dg-do run } +// 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; +} + +int main () +{ + void (A::*p)() = &A::f; + (foo ().*p)(); + p = &A::g; + (foo ().*p)(); + + return 2 - c; +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/pmf8.C b/gcc/testsuite/g++.old-deja/g++.jason/pmf8.C new file mode 100644 index 000000000..35b7d8c43 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/pmf8.C @@ -0,0 +1,30 @@ +// { dg-do run } +// 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; } +}; + + +int main() +{ + User a; + + a.DoAnyThing(&Child::DoSomething); + a.DoAThing(&Child::DoSomething); + a.DoAThing(&Parent::DoSomething); + a.DoAThing(&Parent::i); +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/pmf9.C b/gcc/testsuite/g++.old-deja/g++.jason/pmf9.C new file mode 100644 index 000000000..6d86498cf --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/pmf9.C @@ -0,0 +1,57 @@ +// { dg-do assemble } +// PRMS id: g++/13340 + +class rectangle { + +public: + rectangle(); + int overlaps() const; + +}; + +class region +{ + friend class region_impl; + +public: + region(); + typedef int (region::* region_func)() const; + +}; + +class region_impl { + friend class region; + +private: + rectangle content, mbb; + region_impl *link_p; + region_impl(const rectangle &content); + +public: + int iterate(region *region_p, region::region_func what, + const rectangle &clip_rect) const; + int iterate(region *region_p, region::region_func what, + const region_impl &clip_rgn) const; +}; + + +int +region_impl::iterate (region *region_p, region::region_func what, + const rectangle &clip_rect) const +{ + for (const region_impl *p = this; p != 0 && p->mbb.overlaps(); + p = p->link_p) + if (p->content.overlaps()) + if (!(region_p->*what)()) return 0; + return 1; +} + +int +region_impl::iterate (region *region_p, region::region_func what, + const region_impl &clip_rgn) const +{ + for (const region_impl *p = this; p != 0 && p->mbb.overlaps(); + p = p->link_p) + if (!clip_rgn.iterate(region_p, what, p->content)) return 0; + return 1; +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/pmftemp.C b/gcc/testsuite/g++.old-deja/g++.jason/pmftemp.C new file mode 100644 index 000000000..d54fc57ff --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/pmftemp.C @@ -0,0 +1,16 @@ +// { dg-do assemble } +// PRMS Id: 4484 (bug 1) +// Bug: g++ does not support templates involving method pointers. + +struct A { + void f (); +}; + +template void +f (void (T::*p)()) // { dg-bogus "" } use of template parm as aggregate +{ } + +void g () +{ + f (&A::f); // { dg-bogus "" } templates and method pointers +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/precedence.C b/gcc/testsuite/g++.old-deja/g++.jason/precedence.C new file mode 100644 index 000000000..a11abcdc5 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/precedence.C @@ -0,0 +1,14 @@ +// { dg-do assemble } +// Bug: g++ groups ->* before casts. +// PRMS Id: 4484 (bug 4) + +struct A { }; +struct B : public A { void f (); }; + +void g () +{ + A* ap = new B; + void (B::*p)() = &B::f; + + ((B*)ap->*p)(); // { dg-bogus "" } incorrect precedence +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/redecl1.C b/gcc/testsuite/g++.old-deja/g++.jason/redecl1.C new file mode 100644 index 000000000..6fda9d27a --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/redecl1.C @@ -0,0 +1,13 @@ +// { dg-do assemble } +class A +{ +public: + A (const A& ccref); + friend A const re (const A& v1); // { dg-error "ambiguates" } +}; + +A // const +re (const A& ref) // { dg-error "new declaration" } +{ + return A (ref); +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/ref1.C b/gcc/testsuite/g++.old-deja/g++.jason/ref1.C new file mode 100644 index 000000000..5099077dc --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/ref1.C @@ -0,0 +1,8 @@ +// { dg-do assemble } +// Bug: g++ tries to call a constructor for a reference. Doh! + +class B; +struct A { + B & b; + A (B & x) : b (x) { } // { dg-bogus "" } +}; // { dg-bogus "" } diff --git a/gcc/testsuite/g++.old-deja/g++.jason/ref10.C b/gcc/testsuite/g++.old-deja/g++.jason/ref10.C new file mode 100644 index 000000000..4fe6ffdaf --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/ref10.C @@ -0,0 +1,32 @@ +// { dg-do run } +// 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); +} + +int main() { + D *p = new D; + foo(p); + return bar(p); +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/ref11.C b/gcc/testsuite/g++.old-deja/g++.jason/ref11.C new file mode 100644 index 000000000..e8f8db25b --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/ref11.C @@ -0,0 +1,18 @@ +// { dg-do run } +int main(int argc, char ** argv) { + + int (&var_field_ref)[] = * (int (*)[]) new int [42]; + int (&fix_field_ref)[1] = * (int (*)[1]) new int [42]; + + int static_field[42]; + + int *const &var_field_ptr_ref = var_field_ref; // { dg-bogus "" } + int *const &fix_field_ptr_ref = fix_field_ref; + int *const &static_field_ptr_ref = static_field; + + int * var_field_ptr = var_field_ref; // { dg-bogus "" } + int * fix_field_ptr = fix_field_ref; + int * static_field_ptr = static_field; + + return 0; +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/ref12.C b/gcc/testsuite/g++.old-deja/g++.jason/ref12.C new file mode 100644 index 000000000..a604055fc --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/ref12.C @@ -0,0 +1,6 @@ +// { dg-do run } +void f (const char *const &) { } +int main () +{ + f ("hi"); +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/ref2.C b/gcc/testsuite/g++.old-deja/g++.jason/ref2.C new file mode 100644 index 000000000..0fd789371 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/ref2.C @@ -0,0 +1,6 @@ +// { dg-do assemble } +// Bug: g++ can't deal with references to arrays. + +typedef float Matrix[4][4]; +Matrix m; +Matrix& f () { return m; } diff --git a/gcc/testsuite/g++.old-deja/g++.jason/ref3.C b/gcc/testsuite/g++.old-deja/g++.jason/ref3.C new file mode 100644 index 000000000..b9923cb85 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/ref3.C @@ -0,0 +1,7 @@ +// { dg-do assemble } +// PRMS Id: ???? + +void f (const int& i) +{ + &(int&)i; // { dg-bogus "" } references ARE lvalues +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/ref4.C b/gcc/testsuite/g++.old-deja/g++.jason/ref4.C new file mode 100644 index 000000000..53461d0d4 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/ref4.C @@ -0,0 +1,4 @@ +// { dg-do assemble } + +void f (); +void (&fr)() = f; diff --git a/gcc/testsuite/g++.old-deja/g++.jason/ref5.C b/gcc/testsuite/g++.old-deja/g++.jason/ref5.C new file mode 100644 index 000000000..3ab344288 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/ref5.C @@ -0,0 +1,10 @@ +// { dg-do assemble } + +int i; +int &const j = i; // { dg-error "" } invalid const +int &const f(); // { dg-error "" } invalid const +void g () +{ + j = 1; + f() = 1; +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/ref6.C b/gcc/testsuite/g++.old-deja/g++.jason/ref6.C new file mode 100644 index 000000000..17848af00 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/ref6.C @@ -0,0 +1,3 @@ +// { dg-do assemble } +const int &f(); +int &a = f(); // { dg-error "" } diff --git a/gcc/testsuite/g++.old-deja/g++.jason/ref7.C b/gcc/testsuite/g++.old-deja/g++.jason/ref7.C new file mode 100644 index 000000000..a7a7f8cd5 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/ref7.C @@ -0,0 +1,22 @@ +// { dg-do run } +// 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; } + +int main() +{ + const A& ar = foo(); + const A& ar2 = A(); + const A& ar3 = (A)1; + return destroyed; +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/ref8.C b/gcc/testsuite/g++.old-deja/g++.jason/ref8.C new file mode 100644 index 000000000..97dd51acf --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/ref8.C @@ -0,0 +1,18 @@ +// { dg-do run } +// 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 {}; + +int main() { + C c; + + A& ar = c; + C& cr = (C&)ar; + + cr.foo(); // this line causes core dump +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/ref9.C b/gcc/testsuite/g++.old-deja/g++.jason/ref9.C new file mode 100644 index 000000000..db4426280 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/ref9.C @@ -0,0 +1,26 @@ +// { dg-do run } +// Bug: g++ re-evaluates the initializer for r before calling f(); since i has +// changed to an invalid index, this breaks. + +class C +{ +public: + void f () { } +}; + +void foo (C * objs[]) +{ + int i = 0; + C & r = * objs[i]; /* make reference to element */ + + i = 666; + r.f (); /* core dumps here */ +} + +int +main () +{ + C * objs[1] = { new C }; + + foo (objs); +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/report.C b/gcc/testsuite/g++.old-deja/g++.jason/report.C new file mode 100644 index 000000000..b595662c2 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/report.C @@ -0,0 +1,77 @@ +// { dg-do assemble } +// { dg-options "-Wreturn-type" } +// GROUPS passed error-reporting + +// DR 295 allows qualification via typedef + +template +class badoo +{ +}; + +template +class doowop +{ +}; + +struct A +{ + int a; + ~A () { a = 0; } + operator int () { return a; } +}; + +extern "C" int atoi (const char *); + +int (*fee)(const char *) = atoi; +int (**bar)(const char *) = &fee; + +const char* s = "4"; +const char** sp = &s; +const char*** spp = &sp; + +int foo (int a = (**bar) (s)) +{ + return doowop::bar; // { dg-error "" } not a member +} + +int foo2 (int (*a)(int) = &foo) +{ + undef4 (1); // { dg-error "" } implicit declaration + return 1; +} + +class X{ + class Y{}; // { dg-error "" } private +}; + +typedef int const * bart (); +//The following is DR295 dependant +typedef bart const * const * bar2; +typedef bart volatile * const * bar2v; + +bar2 baz (X::Y y) // { dg-error "" } in this context +{ + X::Y f; // { dg-error "" } in this context + bar2 wa [5]; + wa[0] = baz(f); + undef2 (1); // { dg-error "" } implicit declaration +} // { dg-warning "no return statement" } + +int ninny () +{ + struct A + { + static int ninny2 () { return badoo<'\001'>::foo; } // { dg-error "" } not a member + }; + + return A::ninny2(); +} + +int darg (char X::*p) +{ + undef3 (1); // { dg-error "" } implicit declaration +} // { dg-warning "no return statement" } + +// { dg-message "warning: control reaches end of non-void function" "" { target *-*-* } 36 } +// { dg-message "warning: control reaches end of non-void function" "" { target *-*-* } 65 } diff --git a/gcc/testsuite/g++.old-deja/g++.jason/return.C b/gcc/testsuite/g++.old-deja/g++.jason/return.C new file mode 100644 index 000000000..af9791c57 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/return.C @@ -0,0 +1,22 @@ +// { dg-do run } +// PRMS Id: 5331 +// Bug: the return value of foo is constructed in a temporary and then +// copied into the return slot. This is not necessary. + +int c = 0; + +struct X { + X(int i) { } + X(X const &XX) { c = 1; } + ~X() { } +}; + +const X foo() { + return X(3); +} + +int main() +{ + foo(); + return c; +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/return2.C b/gcc/testsuite/g++.old-deja/g++.jason/return2.C new file mode 100644 index 000000000..132c07929 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/return2.C @@ -0,0 +1,24 @@ +// { dg-do run } +// PRMS Id: 5368 +// Bug: the X temporary in foo() is not destroyed. + +int c = 0; + +struct X { + X (int) { c++; } + ~X() { c--; } +}; + +struct Y { + Y(const X &) { } +}; + +Y foo() { + return X(3); +} + +int main() +{ + foo(); + return c; +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/return3.C b/gcc/testsuite/g++.old-deja/g++.jason/return3.C new file mode 100644 index 000000000..6627fd169 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/return3.C @@ -0,0 +1,20 @@ +// { dg-do run } +// PRMS id: 10912 + +struct A { + A() { i=10; } + int i; +}; +struct B : public A {}; +B b; + +A f() +{ + return b; +} + +int main () +{ + A a = f (); + return a.i != 10; +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/rfg1.C b/gcc/testsuite/g++.old-deja/g++.jason/rfg1.C new file mode 100644 index 000000000..6ded34353 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/rfg1.C @@ -0,0 +1,13 @@ +// { dg-do assemble } +// Bug: g++ parses the declaration of i as a functional cast. + +void take_int (int arg) { } + +void +test () +{ + int (i); + + i = 0; + take_int (i); +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/rfg10.C b/gcc/testsuite/g++.old-deja/g++.jason/rfg10.C new file mode 100644 index 000000000..f6d5af3a8 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/rfg10.C @@ -0,0 +1,11 @@ +// { dg-do assemble } +// Bug: g++ doesn't notice the overflow in the enum values. + +#include + +enum COLOR +{ + red, + green = ULONG_MAX, + blue // { dg-error "overflow in enumeration" } +}; diff --git a/gcc/testsuite/g++.old-deja/g++.jason/rfg11.C b/gcc/testsuite/g++.old-deja/g++.jason/rfg11.C new file mode 100644 index 000000000..3a3db6620 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/rfg11.C @@ -0,0 +1,2 @@ +// { dg-do assemble } +typedef int int; /* { dg-error "" } trying to redefine int */ diff --git a/gcc/testsuite/g++.old-deja/g++.jason/rfg12.C b/gcc/testsuite/g++.old-deja/g++.jason/rfg12.C new file mode 100644 index 000000000..5548e0f63 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/rfg12.C @@ -0,0 +1,2 @@ +// { dg-do assemble } +int array[3] = { 1, 2, 3, 4 }; /* { dg-error "" } excess initializer elements */ diff --git a/gcc/testsuite/g++.old-deja/g++.jason/rfg13.C b/gcc/testsuite/g++.old-deja/g++.jason/rfg13.C new file mode 100644 index 000000000..ae894d13d --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/rfg13.C @@ -0,0 +1,12 @@ +// { dg-do assemble } +// Bug: g++ does overloading on a function-by-function basis. + +void +f () +{ + void (*fp)(void); + { + extern void g (); + } + fp = g; /* { dg-error "" } no 'g' in scope */ +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/rfg14.C b/gcc/testsuite/g++.old-deja/g++.jason/rfg14.C new file mode 100644 index 000000000..85a346afe --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/rfg14.C @@ -0,0 +1,16 @@ +// { dg-do assemble } +void *vp; +int (*ap)[]; +struct S *sp; +union U *up; +int (*fp)(); + +void +test () +{ + vp++; /* { dg-error "" } incrementing void * */ + ap++; /* { dg-error "" } incrementing ptr to incomplete type */ + sp++; /* { dg-error "" } incrementing ptr to incomplete type */ + up++; /* { dg-error "" } incrementing ptr to incomplete type */ + fp++; /* { dg-error "" } incrementing ptr to function */ +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/rfg16.C b/gcc/testsuite/g++.old-deja/g++.jason/rfg16.C new file mode 100644 index 000000000..d42516d4f --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/rfg16.C @@ -0,0 +1,5 @@ +// { dg-do assemble } +// Bug: g++ doesn't push parameter decls as they are parsed. + +void (*ptr) (int foo, int array[sizeof(foo)]); +void test2 (int bar, int array[sizeof(bar)]) { } diff --git a/gcc/testsuite/g++.old-deja/g++.jason/rfg17.C b/gcc/testsuite/g++.old-deja/g++.jason/rfg17.C new file mode 100644 index 000000000..a138f9ad9 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/rfg17.C @@ -0,0 +1,16 @@ +// { dg-do assemble } +// The default assignment operator for B uses array assignment, so we can't +// just disallow it... + +struct A { A& operator=(const A&); }; +struct B { A f[20]; }; + +int a1[20], a2[20]; +B b1, b2; + +void +test () +{ + b1 = b2; /* OK */ + a1 = a2; /* { dg-error "" } array assignment */ +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/rfg18.C b/gcc/testsuite/g++.old-deja/g++.jason/rfg18.C new file mode 100644 index 000000000..9c32b1f02 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/rfg18.C @@ -0,0 +1,11 @@ +// { dg-do assemble } +// Any expression may be explicitly converted to type void. + +struct S { int m[10]; } object; +struct S f () { return object; } + +void +test () +{ + (void) f().m; /* OK - cast to void; see constraints in 3.8.1 */ +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/rfg2.C b/gcc/testsuite/g++.old-deja/g++.jason/rfg2.C new file mode 100644 index 000000000..44cb1cb02 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/rfg2.C @@ -0,0 +1,6 @@ +// { dg-do assemble } +// Bug: g++ complains about a class definition containing a const member +// but no constructor; it shouldn't complain at that point, since this is +// valid use. + +struct S { const int member; } object = { 0 }; diff --git a/gcc/testsuite/g++.old-deja/g++.jason/rfg20.C b/gcc/testsuite/g++.old-deja/g++.jason/rfg20.C new file mode 100644 index 000000000..505f7c949 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/rfg20.C @@ -0,0 +1,10 @@ +// { dg-do assemble } + +typedef void func_type (); +func_type *fp; +void *vp; + +void example () +{ + vp != fp; // { dg-error "forbids comparison" } no conversion from pfn to void* +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/rfg21.C b/gcc/testsuite/g++.old-deja/g++.jason/rfg21.C new file mode 100644 index 000000000..cce28e89a --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/rfg21.C @@ -0,0 +1,2 @@ +// { dg-do assemble } +char array0[4] = "abcde"; /* { dg-error "" } initializer too long */ diff --git a/gcc/testsuite/g++.old-deja/g++.jason/rfg22.C b/gcc/testsuite/g++.old-deja/g++.jason/rfg22.C new file mode 100644 index 000000000..7fee2ac23 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/rfg22.C @@ -0,0 +1,7 @@ +// { dg-do assemble } +static void f (); // { dg-error "" } used but not defined + +void g () +{ + f (); +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/rfg23.C b/gcc/testsuite/g++.old-deja/g++.jason/rfg23.C new file mode 100644 index 000000000..8bf9f7c56 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/rfg23.C @@ -0,0 +1,3 @@ +// { dg-do assemble } + signed char *ptr2 = "hello"; /* { dg-error "" } changing sign */ +unsigned char *ptr3 = "hello"; /* { dg-error "" } changing sign */ diff --git a/gcc/testsuite/g++.old-deja/g++.jason/rfg24.C b/gcc/testsuite/g++.old-deja/g++.jason/rfg24.C new file mode 100644 index 000000000..1aa05c0a9 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/rfg24.C @@ -0,0 +1,9 @@ +// { dg-do assemble } +typedef int Int; + +Int Int_object_1; + +void test () +{ + ((Int) Int_object_1) = Int_object_1; /* { dg-error "" } not an lvalue*/ +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/rfg25.C b/gcc/testsuite/g++.old-deja/g++.jason/rfg25.C new file mode 100644 index 000000000..713a6918c --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/rfg25.C @@ -0,0 +1,2 @@ +// { dg-do assemble } +struct { int :0; }; /* { dg-error "" } anon struct not used to declare objects */ diff --git a/gcc/testsuite/g++.old-deja/g++.jason/rfg26.C b/gcc/testsuite/g++.old-deja/g++.jason/rfg26.C new file mode 100644 index 000000000..2b7e06085 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/rfg26.C @@ -0,0 +1,10 @@ +// { dg-do assemble } +typedef void (FTYPE) (); + +FTYPE f; /* ok */ + +void +test_0 () +{ + (FTYPE) f; /* { dg-error "" } casting to function type */ +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/rfg27.C b/gcc/testsuite/g++.old-deja/g++.jason/rfg27.C new file mode 100644 index 000000000..dd20747ef --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/rfg27.C @@ -0,0 +1,8 @@ +// { dg-do assemble } +// { dg-options "-pedantic-errors" } +// Don't compile this one with -Wno-long-long... + +short volatile short var_0_2; /* { dg-error "" } duplicate short */ +long volatile long var_0_3; /* { dg-error "" } duplicate long */ +signed volatile signed var_0_7; /* { dg-error "" } duplicate signed */ +unsigned volatile unsigned var_0_8; /* { dg-error "" } duplicate unsigned */ diff --git a/gcc/testsuite/g++.old-deja/g++.jason/rfg28.C b/gcc/testsuite/g++.old-deja/g++.jason/rfg28.C new file mode 100644 index 000000000..e910c2408 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/rfg28.C @@ -0,0 +1,10 @@ +// { dg-do assemble } +/* From 01/25/94 working paper (7.1.3): + + If, in a decl-specifier-seq containing the decl-specifier typedef, + there is no type-specifier, or the only type-specifiers are cv- + qualifiers, the typedef declaration is ill-formed. +*/ + +typedef foo; // { dg-error "" } invalid typedef +typedef const bar; // { dg-error "" } invalid typedef diff --git a/gcc/testsuite/g++.old-deja/g++.jason/rfg3.C b/gcc/testsuite/g++.old-deja/g++.jason/rfg3.C new file mode 100644 index 000000000..93f74685c --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/rfg3.C @@ -0,0 +1,15 @@ +// { dg-do assemble } +// Bug: g++ remembers the members of OUTER and complains about the second +// definition. + +void +test () +{ + { + struct OUTER { struct INNER { int mbr; } member; }; + } + + { + struct OUTER { struct INNER { int mbr; } member; }; + } +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/rfg4.C b/gcc/testsuite/g++.old-deja/g++.jason/rfg4.C new file mode 100644 index 000000000..fbc3841dd --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/rfg4.C @@ -0,0 +1,13 @@ +// { dg-do assemble } +// { dg-options "-ansi -pedantic-errors -w" } +// Bug: f1 and f2 are treated as overloaded when they aren't. + +int i; +void f1(double) { } +void f2(double) { } + +void +test () +{ + i ? f1 : f2; // { dg-bogus "" } improper overloading +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/rfg5.C b/gcc/testsuite/g++.old-deja/g++.jason/rfg5.C new file mode 100644 index 000000000..11ee9c035 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/rfg5.C @@ -0,0 +1,11 @@ +// { dg-do assemble } +// { dg-options "-ansi -pedantic-errors -w" } +// Bug: func is treated as an overloaded function when it isn't. + +int *func () { return 0; } + +void +test () +{ + *func; // { dg-bogus "" } improper overloading +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/rfg6.C b/gcc/testsuite/g++.old-deja/g++.jason/rfg6.C new file mode 100644 index 000000000..c2bca4554 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/rfg6.C @@ -0,0 +1,4 @@ +// { dg-do assemble } + +const wchar_t *single = L"xyz" ; +const wchar_t *(array[]) = { L"xyz" }; diff --git a/gcc/testsuite/g++.old-deja/g++.jason/rfg7.C b/gcc/testsuite/g++.old-deja/g++.jason/rfg7.C new file mode 100644 index 000000000..db19deeab --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/rfg7.C @@ -0,0 +1,6 @@ +// { dg-do assemble } +// Bug: fixincludes and/or cpp mangle the definition of wchar_t so that this +// doesn't work. + +#include +wchar_t array[] = L"xxx"; // { dg-bogus "" } wchar_t diff --git a/gcc/testsuite/g++.old-deja/g++.jason/rfg8.C b/gcc/testsuite/g++.old-deja/g++.jason/rfg8.C new file mode 100644 index 000000000..39ef34cf8 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/rfg8.C @@ -0,0 +1,4 @@ +// { dg-do assemble } +// Bug: g++ is wrongfully pedantic about union initializers. + +union U { int mbr; } array[1] = { 0 }; diff --git a/gcc/testsuite/g++.old-deja/g++.jason/rfg9.C b/gcc/testsuite/g++.old-deja/g++.jason/rfg9.C new file mode 100644 index 000000000..ec15d13e2 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/rfg9.C @@ -0,0 +1,10 @@ +// { dg-do assemble } +int cond; +int i; +int *ip; + +void +test () +{ + cond ? i : ip; /* { dg-error "" } pointer/integer mismatch */ +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/rvalue1.C b/gcc/testsuite/g++.old-deja/g++.jason/rvalue1.C new file mode 100644 index 000000000..277d594b8 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/rvalue1.C @@ -0,0 +1,52 @@ +// { dg-do run } +// PRMS Id: 6000 +// Bug: g++ gets confused trying to build up a reference to a cast. + +class String { +protected: + char *cp; +public: + String(char *incp); + String(const String &constStringRef); + virtual void virtualFn1(void) const {;} +}; + +String::String(char *incp) +{ + cp = incp; +} + +String::String(const String &constStringRef) +{ +// Right here, do an 'info args', and look at the virtual function table +// pointer: typically junk! Calling the function through that table could +// do anything, since we're really leaping off into the void. This example +// goes down with 'SIGBUS', but I've seen 'SIGSEGV' too, and 'SIGILL' is +// possible. + + cp = constStringRef.cp; + constStringRef.virtualFn1(); +} + +void foofun(String string) +{ + ; +} + +class Class1 { +public: + Class1(const String & constStringRef); +}; + +Class1 :: Class1 (const String & constStringRef) +{ +// If instead of calling the function 'foofun()' here, we just assign +// 'constStringRef' to a local variable, then the vptr is typically == 0! + + foofun(String(constStringRef)); +} + +int main(void) +{ + Class1 *class1 = new Class1((char*) "Hi!"); +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/rvalue2.C b/gcc/testsuite/g++.old-deja/g++.jason/rvalue2.C new file mode 100644 index 000000000..77189a5eb --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/rvalue2.C @@ -0,0 +1,18 @@ +// { dg-do run } +// Test for undesired aliasing. + +struct A { + const A * get_this () const { return this; } +}; + +int 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; +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/rvalue3.C b/gcc/testsuite/g++.old-deja/g++.jason/rvalue3.C new file mode 100644 index 000000000..58cdad5d2 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/rvalue3.C @@ -0,0 +1,6 @@ +// { dg-do assemble } +int main () +{ + int i; + int &ir = (int&)(int)i; // { dg-error "" } casting rvalue to reference type +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/scoping.C b/gcc/testsuite/g++.old-deja/g++.jason/scoping.C new file mode 100644 index 000000000..ef1673069 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/scoping.C @@ -0,0 +1,12 @@ +// { dg-do assemble } +// PRMS Id: 3977 +// Bug: A member function is not hidden properly by a later use of its name. + +struct A { + void index (); +}; + +struct B: A { + int index; + B(): index(4) {} +}; diff --git a/gcc/testsuite/g++.old-deja/g++.jason/scoping10.C b/gcc/testsuite/g++.old-deja/g++.jason/scoping10.C new file mode 100644 index 000000000..a1b563297 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/scoping10.C @@ -0,0 +1,16 @@ +// { dg-do assemble } +// Test for scope-based hiding of functions. + +void f (char *); +struct A { + void f (); // { dg-message "A::f|candidate expects" } referred to +}; +struct B : public A { + void g (char *); + void h () { + extern void g (); // { dg-message "" } + f("foo"); // { dg-error "" } hidden + // { dg-message "candidate" "candidate note" { target *-*-* } 12 } + g("foo"); // { dg-error "" } hidden + } +}; diff --git a/gcc/testsuite/g++.old-deja/g++.jason/scoping11.C b/gcc/testsuite/g++.old-deja/g++.jason/scoping11.C new file mode 100644 index 000000000..9a3717d57 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/scoping11.C @@ -0,0 +1,11 @@ +// { dg-do assemble } + +void f (); +void g () +{ + int f; + { + void f (); + f (); // { dg-bogus "" } trying to call integer + } +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/scoping12.C b/gcc/testsuite/g++.old-deja/g++.jason/scoping12.C new file mode 100644 index 000000000..a7834163b --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/scoping12.C @@ -0,0 +1,10 @@ +// { dg-do assemble } +void f () +{ + struct A { + friend void g (); // { dg-error "without prior declaration" } + }; +} +void h () { + g (); // { dg-error "" } no g in scope +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/scoping13.C b/gcc/testsuite/g++.old-deja/g++.jason/scoping13.C new file mode 100644 index 000000000..fc90902a3 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/scoping13.C @@ -0,0 +1,10 @@ +// { dg-do assemble } + +struct A { typedef int foo; }; +struct B: public A { + typedef int bar; + struct C { + void g (B::bar); // { dg-bogus "" } nested type failure + void f (B::foo); + }; +}; diff --git a/gcc/testsuite/g++.old-deja/g++.jason/scoping14.C b/gcc/testsuite/g++.old-deja/g++.jason/scoping14.C new file mode 100644 index 000000000..f53f72a60 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/scoping14.C @@ -0,0 +1,8 @@ +// { dg-do assemble } +// [class.scope0]: The scope of a name declared in a class consists +// ... also of all ... default arguments ... in that class .... + +struct A { + void f (int A::* = &A::i); + int i; +}; diff --git a/gcc/testsuite/g++.old-deja/g++.jason/scoping15.C b/gcc/testsuite/g++.old-deja/g++.jason/scoping15.C new file mode 100644 index 000000000..cc34c5f57 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/scoping15.C @@ -0,0 +1,21 @@ +// { dg-do assemble } +// { dg-options "-ffriend-injection" } +// Bug: g++ ignores the :: qualification and dies trying to treat an integer +// variable as a list of functions. + +class DComplex { +public: + friend double imag(const DComplex& a); +}; + +class FComplex { +public: + friend float imag(const FComplex& a); +}; + +void +scnrm2(FComplex cx[]) +{ + int imag; + ::imag( cx[0] ); +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/scoping16.C b/gcc/testsuite/g++.old-deja/g++.jason/scoping16.C new file mode 100644 index 000000000..9b9d915ba --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/scoping16.C @@ -0,0 +1,5 @@ +// { dg-do assemble } +struct A { + int a(); // { dg-error "" } + int a; // { dg-error "" } +}; diff --git a/gcc/testsuite/g++.old-deja/g++.jason/scoping17.C b/gcc/testsuite/g++.old-deja/g++.jason/scoping17.C new file mode 100644 index 000000000..c51dbef68 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/scoping17.C @@ -0,0 +1,9 @@ +// { dg-do run } +// Test that the integer hides the struct in block scope. + +int main () +{ + int A; + struct A { }; + A = 1; +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/scoping2.C b/gcc/testsuite/g++.old-deja/g++.jason/scoping2.C new file mode 100644 index 000000000..637e74b24 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/scoping2.C @@ -0,0 +1,15 @@ +// { dg-do assemble } +// Bug: A function is not hidden properly by a use of its name in an +// inner scope. + +struct A +{ + struct B + { + int f; + B() : f(0) {} + void g() { f = 0; } + }; + void f(); + void f(int); +}; diff --git a/gcc/testsuite/g++.old-deja/g++.jason/scoping3.C b/gcc/testsuite/g++.old-deja/g++.jason/scoping3.C new file mode 100644 index 000000000..31a75cf0a --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/scoping3.C @@ -0,0 +1,8 @@ +// { dg-do assemble } +// Bug: g++ does not grok nested types very well. + +class A { + class B; + friend class B; + class B { }; // { dg-bogus "" } +}; diff --git a/gcc/testsuite/g++.old-deja/g++.jason/scoping4.C b/gcc/testsuite/g++.old-deja/g++.jason/scoping4.C new file mode 100644 index 000000000..c32b4a660 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/scoping4.C @@ -0,0 +1,30 @@ +// { dg-do assemble } +// PRMS Id: 4375 +// Bug: g++ fails to keep track of nested typedefs properly. + +class A { +public: + typedef const 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) { // { dg-bogus "" } + s = string; // { dg-bogus "" } +} + +int main() { + A a("testing"); + A *a_ptr; + B b(&a); + a_ptr = b.get_A(); +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/scoping5.C b/gcc/testsuite/g++.old-deja/g++.jason/scoping5.C new file mode 100644 index 000000000..8c4d7fdde --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/scoping5.C @@ -0,0 +1,6 @@ +// { dg-do assemble } +// Bug: g++ thinks that A defines operator delete, and tries to call it. + +struct A { + ~A () { ::operator delete (0); } +}; diff --git a/gcc/testsuite/g++.old-deja/g++.jason/scoping6.C b/gcc/testsuite/g++.old-deja/g++.jason/scoping6.C new file mode 100644 index 000000000..2f33010fd --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/scoping6.C @@ -0,0 +1,27 @@ +// { dg-do assemble } +// Testcase for all uses of explicit global scope. + +int a, B; + +struct A { }; +int operator+(A&, int); + +struct B { + struct C { + static int a; + static int f () { A a; return ::operator+ (a, ::a); } // { dg-bogus "" } + }; +}; + +int B::C::a = 0; + +struct D : public ::B::C { }; // { dg-bogus "" } + +void f () +{ + int B; + ::B::C b; + + B = ::B::C::a; // { dg-bogus "" } + B = ::B::C::f(); // { dg-bogus "" } +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/scoping7.C b/gcc/testsuite/g++.old-deja/g++.jason/scoping7.C new file mode 100644 index 000000000..41859aa39 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/scoping7.C @@ -0,0 +1,6 @@ +// { dg-do assemble } +// Bug: g++ doesn't flag name collisions between types and non-types as +// errors. It shouldn't for class names, but it should for typedefs. + +int bar; // { dg-error "" } +typedef int bar; // { dg-error "" } diff --git a/gcc/testsuite/g++.old-deja/g++.jason/scoping8.C b/gcc/testsuite/g++.old-deja/g++.jason/scoping8.C new file mode 100644 index 000000000..bb31735f2 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/scoping8.C @@ -0,0 +1,8 @@ +// { dg-do assemble } +// Bug: g++ allows two different meanings of a name in the same scope. + +typedef int foo; // { dg-error "" } +struct A { + A (foo); + int foo (); // { dg-error "" } foo already used in scope +}; diff --git a/gcc/testsuite/g++.old-deja/g++.jason/scoping9.C b/gcc/testsuite/g++.old-deja/g++.jason/scoping9.C new file mode 100644 index 000000000..be991185f --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/scoping9.C @@ -0,0 +1,12 @@ +// { dg-do assemble } +// Bug: g++ silently mangles the second 'B' to 'A::B', so the definition is +// lost. + +struct A { + enum B { }; +}; + +struct C: public A { + enum B { }; + void foo (C::B); +}; diff --git a/gcc/testsuite/g++.old-deja/g++.jason/shadow1.C b/gcc/testsuite/g++.old-deja/g++.jason/shadow1.C new file mode 100644 index 000000000..941f80cfc --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/shadow1.C @@ -0,0 +1,16 @@ +// { dg-do assemble } +// { dg-options "-Wshadow" } + +class x { +public: + void fun(); +private: + int foo; +}; + +void x::fun() { } + +main () +{ + float foo; +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/soverload.C b/gcc/testsuite/g++.old-deja/g++.jason/soverload.C new file mode 100644 index 000000000..b29e64936 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/soverload.C @@ -0,0 +1,10 @@ +// { dg-do assemble } +// Bug: dfs_pushdecls doesn't create an overload list for member functions, +// like it claims to. + +struct A +{ + static int foo (int); + static int foo (int, int); + void bar () { foo (1, 2); } // { dg-bogus "" } broken overloading +}; diff --git a/gcc/testsuite/g++.old-deja/g++.jason/special.C b/gcc/testsuite/g++.old-deja/g++.jason/special.C new file mode 100644 index 000000000..29565d548 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/special.C @@ -0,0 +1,7 @@ +// { dg-do assemble } +// Make sure that forward declarations of specializations work... + +template class A { }; +template <> class A; +A a; // { dg-error "" } incomplete type +template <> class A { }; diff --git a/gcc/testsuite/g++.old-deja/g++.jason/static1.C b/gcc/testsuite/g++.old-deja/g++.jason/static1.C new file mode 100644 index 000000000..2c6f6bd4d --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/static1.C @@ -0,0 +1,32 @@ +// { dg-do run } +// PRMS id: 6863 + +extern "C" int printf(const char *, ...); +extern "C" void abort(); + +enum ENUM {E1=0, E2 }; +int d; + +class AAA{ +public: + AAA() {a = new char[10];printf("constructor AAA() called\n");} + AAA(int) {printf("constructor AAA(int) called\n");} + ~AAA(){ printf("destructor ~AAA() called\n"); d = 1; } + operator int () { return 1;} + char *a; + int i; +}; + +struct sentinel { + ~sentinel () { if (d == 0) abort (); } +} s; + +/* forward decl here causes gcc not to execute ct and dt for arr1 */ +extern AAA arr1[]; + +AAA arr1[] = {(int)E1 }; + +int main() +{ + return 0; +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/synth.C b/gcc/testsuite/g++.old-deja/g++.jason/synth.C new file mode 100644 index 000000000..a57f23ce9 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/synth.C @@ -0,0 +1,13 @@ +// { dg-do assemble } +// Bug: the synthesized copy constructor for A is not found. + +struct A { + // A (const A& a): i(a.i) {} + int i; +}; + +struct B { + A a; + B (const B& b): a(b.a), j(b.j) { } // { dg-bogus "" } + int j; +}; diff --git a/gcc/testsuite/g++.old-deja/g++.jason/synth10.C b/gcc/testsuite/g++.old-deja/g++.jason/synth10.C new file mode 100644 index 000000000..f6181dc7c --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/synth10.C @@ -0,0 +1,52 @@ +// { dg-do assemble } +// { dg-options "-O" } +// Bug: Synthesizing methods for the nested class screwed up current_class_decl +// for the outer class. + +class A; +class AH +{ + public: + AH ( A * p = 0 ); + AH ( const AH & from ) + : pointer( from.pointer ) { inc(); } + ~ AH () { dec(); } + private: + A * pointer; + void inc() const; + void dec() const; +}; + +class A +{ + protected: + struct AttrTable + { + struct Row + { + }; + }; + + public: + + class Attributes + { + public: + class iterator + { + public: + iterator() : mo(0), attr(0) {} + iterator& operator++() { ++attr; return *this; } + iterator operator++(int) + { iterator tmp = *this; ++*this; return tmp; } + + private: + AH mo; + const AttrTable::Row* attr; + }; + + Attributes(AH mo) + : mo(mo) {} + AH mo; + }; +}; diff --git a/gcc/testsuite/g++.old-deja/g++.jason/synth2.C b/gcc/testsuite/g++.old-deja/g++.jason/synth2.C new file mode 100644 index 000000000..5e420913f --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/synth2.C @@ -0,0 +1,8 @@ +// { dg-do assemble } +// PRMS Id: 4623 +// Bug: g++ tries and fails to synthesize a copy constructor for D. + +class A { }; +class B: public virtual A { }; +class C: public A { }; +class D: public B, public C { }; // { dg-bogus "" } bad synthesis diff --git a/gcc/testsuite/g++.old-deja/g++.jason/synth3.C b/gcc/testsuite/g++.old-deja/g++.jason/synth3.C new file mode 100644 index 000000000..ff304f99e --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/synth3.C @@ -0,0 +1,6 @@ +// { dg-do assemble } +// Testcase for wrongful generation of copy constructor. + +class A { }; +class B: virtual private A { }; +class D: public B { }; // { dg-bogus "" } diff --git a/gcc/testsuite/g++.old-deja/g++.jason/synth4.C b/gcc/testsuite/g++.old-deja/g++.jason/synth4.C new file mode 100644 index 000000000..c35780cc3 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/synth4.C @@ -0,0 +1,15 @@ +// { dg-do assemble } + +struct X { + X(); +}; +typedef void (X::*mfp)(); +struct Y { + Y(); + mfp memfp; +}; +void f() +{ + Y *y1, *y2 ; + *y1 = *y2; // { dg-bogus "" } failed to synthesize op= +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/synth5.C b/gcc/testsuite/g++.old-deja/g++.jason/synth5.C new file mode 100644 index 000000000..f5e73807c --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/synth5.C @@ -0,0 +1,15 @@ +// { dg-do run } +// 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" +int main() { } diff --git a/gcc/testsuite/g++.old-deja/g++.jason/synth6.C b/gcc/testsuite/g++.old-deja/g++.jason/synth6.C new file mode 100644 index 000000000..01485282e --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/synth6.C @@ -0,0 +1,15 @@ +// { dg-do assemble } +// Bug: g++ tries to generate an op= for DbmItem and fails. + +class RefCount{ +public: + RefCount(); + +private: + RefCount& operator=(const RefCount); +}; + +class DbmItem: public RefCount{ +public: + DbmItem(): RefCount() {} +}; diff --git a/gcc/testsuite/g++.old-deja/g++.jason/synth7.C b/gcc/testsuite/g++.old-deja/g++.jason/synth7.C new file mode 100644 index 000000000..33beb911f --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/synth7.C @@ -0,0 +1,12 @@ +// { dg-do run } +// Testcase to make sure that synthesized methods are found when needed. + +struct B { ~B() { } }; +struct A { B b; }; + +int main() +{ + A a, b (a), c = A(); + A& (A::*afp)(const A&) = &A::operator=; + (a.*afp) (b); +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/synth8.C b/gcc/testsuite/g++.old-deja/g++.jason/synth8.C new file mode 100644 index 000000000..29abc2ae6 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/synth8.C @@ -0,0 +1,20 @@ +// { dg-do assemble } +// Bug: the synthesized constructor for A tries to use the mem-initializer +// list for the B constructor. + +struct A +{ + virtual ~A(); +}; + +struct B +{ + B(); + char* x; + A* a; +}; + +B::B() +: x(0), a(new A()) +{ +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/synth9.C b/gcc/testsuite/g++.old-deja/g++.jason/synth9.C new file mode 100644 index 000000000..86b8ddfef --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/synth9.C @@ -0,0 +1,20 @@ +// { dg-do assemble } +// PRMS Id: 6837 +// Bug: anonymous union confuses g++. + +struct my_key { + my_key(const my_key&); + my_key(const char* n); +}; + +struct my_node { + my_node(my_key&); + union { + long cnt; + my_node* next; + }; + my_key a; +}; + +extern my_node n; +my_node a(n); diff --git a/gcc/testsuite/g++.old-deja/g++.jason/tempargs.C b/gcc/testsuite/g++.old-deja/g++.jason/tempargs.C new file mode 100644 index 000000000..5ca92350a --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/tempargs.C @@ -0,0 +1,8 @@ +// { dg-do assemble } +// GROUPS passed templates overloading +template class Vector { }; +template struct Sort { static void sort (Vector &); }; +template void Sort::sort (Vector &) { } +struct whee { typedef int foo; }; + +void f (Vector &vi) { Sort::sort (vi); } diff --git a/gcc/testsuite/g++.old-deja/g++.jason/tempcons.C b/gcc/testsuite/g++.old-deja/g++.jason/tempcons.C new file mode 100644 index 000000000..a9974dbf7 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/tempcons.C @@ -0,0 +1,8 @@ +// { dg-do assemble } +// Bug: member initializers are allowed where they shouldn't be. + +template +struct A { + int i; + Blarg () : i(0) { } // { dg-error "" } +}; diff --git a/gcc/testsuite/g++.old-deja/g++.jason/tempdest.C b/gcc/testsuite/g++.old-deja/g++.jason/tempdest.C new file mode 100644 index 000000000..f1940a4db --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/tempdest.C @@ -0,0 +1,20 @@ +// { dg-do assemble } +// GROUPS passed templates destructors +// Example of PR 3308 workaround + +template +class A +{ + T q; +public: + ~A() { (&q)->T::~T(); } +}; + +typedef unsigned int ui; + +int main() +{ + A *ap = new A; + + delete ap; +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/tempinst1.C b/gcc/testsuite/g++.old-deja/g++.jason/tempinst1.C new file mode 100644 index 000000000..966256f37 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/tempinst1.C @@ -0,0 +1,23 @@ +// { dg-do link } +// { dg-options "-g" } +// Bug: g++ fails to instantiate operator<<. + +struct ostream { + ostream& operator<< (const char *) { return *this; }; +}; + +template class foo; + +template ostream& operator<< (ostream& ios, foo&obj) {return ios;} + +template class foo { + friend ostream& operator<<<>(ostream&, foo&); +}; + +int main() +{ + ostream cout; + foo foo_obj; + cout << foo_obj; // causes linker error + return 0; +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/template1.C b/gcc/testsuite/g++.old-deja/g++.jason/template1.C new file mode 100644 index 000000000..359c8f165 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/template1.C @@ -0,0 +1,20 @@ +// { dg-do assemble } +// PRMS Id: 4688 +// Bug: g++ can't deal with templates instantiated within extern "C". + +class Gnaf { +public: + virtual int invariant (); +}; + +template class Array : public Gnaf { +public: + virtual int invariant(); +}; + +extern "C" +int foo() +{ + Array toConv; + return 0; +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/template10.C b/gcc/testsuite/g++.old-deja/g++.jason/template10.C new file mode 100644 index 000000000..196ea34b7 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/template10.C @@ -0,0 +1,31 @@ +// { dg-do assemble } +// Bug: member operator shadows global template in tsubst. + +class ostream; + +template class smanip; + +template +ostream& operator<<(ostream& o, const smanip& m); + +template class smanip { +public: + friend ostream& operator<< <>(ostream &o, const smanip&m); +}; + +template +ostream& operator<<(ostream& o, const smanip& m) +{ return o;} + +class X +{ +public: + X operator<<(int); // commenting out this line makes it work! + void print(ostream& os); +}; + +void X::print(ostream& os) +{ + smanip smd; + os << smd; // { dg-bogus "" } +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/template11.C b/gcc/testsuite/g++.old-deja/g++.jason/template11.C new file mode 100644 index 000000000..004361d6c --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/template11.C @@ -0,0 +1,16 @@ +// { dg-do run } +// Bug: initializers for static data members of templates don't get run. + +template struct A { + static T t; +}; + +int foo () { return 1; } + +template <> +int A::t = foo (); + +int main () +{ + return (A::t != 1); +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/template12.C b/gcc/testsuite/g++.old-deja/g++.jason/template12.C new file mode 100644 index 000000000..d26dfbd75 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/template12.C @@ -0,0 +1,14 @@ +// { dg-do assemble } +// Testcase for 'this is a type' syntax. + +struct B { + typedef int A; +}; + +template struct Y { + void f() { + typename T::A *d; + } +}; + +template class Y; diff --git a/gcc/testsuite/g++.old-deja/g++.jason/template14.C b/gcc/testsuite/g++.old-deja/g++.jason/template14.C new file mode 100644 index 000000000..4576ec3f8 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/template14.C @@ -0,0 +1,17 @@ +// { dg-do run } +// PRMS Id: 4745 +// Bug: g++ gets the constructor and destructor confused because the default +// parm prevents the two constructor types from satisfying ==. + +template struct A { + A(int = 1); + ~A(); +}; + +template A::A(int) { } // causes compiler abort +template A::~A() { } + +int main() +{ + A a; +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/template15.C b/gcc/testsuite/g++.old-deja/g++.jason/template15.C new file mode 100644 index 000000000..b1530201b --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/template15.C @@ -0,0 +1,28 @@ +// { dg-do run } +// PRMS Id: 2139 +// Bug: g++ tries to instantiate the template with types on the function +// obstack and fails. + +template +class X { +public: + X(int) { } + + T x; +}; + +class A { }; + +int main() +{ + int i; + X xi(i); + X xd(i); + + X fp0(i); + X fp1(i); + X fp2(i); + + X mp0 (i); + X mp1 (i); +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/template16.C b/gcc/testsuite/g++.old-deja/g++.jason/template16.C new file mode 100644 index 000000000..09877a5a6 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/template16.C @@ -0,0 +1,34 @@ +// { dg-do run } +// PRMS Id: 1502 +// Bug: g++ fails to resolve 'gnc' in the call to 'grid'. + +template class foo { +public: + foo() { } +}; + +template class bar : public foo { +public: + bar() : foo() {} +}; + +template class ben : public foo { +public: + ben() : foo() {} + void grid(T (*f)(bar&),bar& x,bar& y,bar& param); +}; + +template void ben::grid(T (*f)(bar&),bar& x,bar& y,bar& param) { } + +template T gnc(bar& a) +{ + return 0; +} + +int main() +{ + ben a; + bar x,y,p; + a.grid(gnc,x,y,p); + return 0; +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/template17.C b/gcc/testsuite/g++.old-deja/g++.jason/template17.C new file mode 100644 index 000000000..2bb36aa9e --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/template17.C @@ -0,0 +1,11 @@ +// { dg-do assemble } +// Caught by Booch Components. +// Bug: g++ tries to instantiate nested enums. + +template struct A +{ + struct B { }; + enum C { c }; +}; + +template struct A; diff --git a/gcc/testsuite/g++.old-deja/g++.jason/template19.C b/gcc/testsuite/g++.old-deja/g++.jason/template19.C new file mode 100644 index 000000000..0a57742a3 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/template19.C @@ -0,0 +1,10 @@ +// { dg-do run } +// Make sure type deduction isn't confused by top-level cv-quals. +template T max (const T a, const T b) { return a>b?a:b; } + +int main() +{ + int a = 0, b = 1; + int c = max (a, b); + int d = max ((const int)a, (const int)b); +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/template2.C b/gcc/testsuite/g++.old-deja/g++.jason/template2.C new file mode 100644 index 000000000..07c54f82f --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/template2.C @@ -0,0 +1,12 @@ +// { dg-do assemble } +// Bug: instantiation of member templates breaks. + +template struct A { + static void f (); + void g (); +}; + +template void A::f () { } +template void A::g () { } + +A a; diff --git a/gcc/testsuite/g++.old-deja/g++.jason/template20.C b/gcc/testsuite/g++.old-deja/g++.jason/template20.C new file mode 100644 index 000000000..2cbaffb67 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/template20.C @@ -0,0 +1,10 @@ +// { dg-do run } +// Make sure type deduction works for both types of array parameters. +template void f (T (&a)[2]) { } +template void g (T a[2]) { } +int main() +{ + int a[2] = { 0, 0 }; + f (a); + g (a); +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/template21.C b/gcc/testsuite/g++.old-deja/g++.jason/template21.C new file mode 100644 index 000000000..86b613136 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/template21.C @@ -0,0 +1,16 @@ +// { dg-do assemble } +// Gosh, this works! + +template +struct A +{ + struct B + { + void bar(); + }; + struct C { }; +}; + +template void A::B::bar() { } + +template class A; diff --git a/gcc/testsuite/g++.old-deja/g++.jason/template22.C b/gcc/testsuite/g++.old-deja/g++.jason/template22.C new file mode 100644 index 000000000..f6e81aa36 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/template22.C @@ -0,0 +1,31 @@ +// { dg-do assemble } +// Testcase for proper unification of code involving references. + +template +struct A +{ + void foo(); +}; + +template void A::foo() { } + +template class A; + +const int& f1 (); +int& f2 (); +int f3 (); + +template void g1 (const T&); +template void g2 (T&); +template void g3 (T); + +int main() +{ + g1 (f1 ()); + g1 (f2 ()); + g1 (f3 ()); + g2 (f2 ()); + g3 (f1 ()); + g3 (f2 ()); + g3 (f3 ()); +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/template23.C b/gcc/testsuite/g++.old-deja/g++.jason/template23.C new file mode 100644 index 000000000..f2d997377 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/template23.C @@ -0,0 +1,12 @@ +// { dg-do assemble } +// Testcase for instantiation with cv-qualified type + +template +struct A +{ + void foo(); +}; + +template void A::foo() { } + +template class A; diff --git a/gcc/testsuite/g++.old-deja/g++.jason/template24.C b/gcc/testsuite/g++.old-deja/g++.jason/template24.C new file mode 100644 index 000000000..0efce9ff1 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/template24.C @@ -0,0 +1,23 @@ +// { dg-do run } +// Bug: g++ doesn't find the conversion from ostream_withassign to ostream. + +#include + +template +struct A { + T t; +}; + +template +std::ostream & operator<< (std::ostream & os, A & a) +{ + os << a.t; + return os; +} + +int main () +{ + A a = { 1 }; + std::cout << a << std::endl; +} + diff --git a/gcc/testsuite/g++.old-deja/g++.jason/template25.C b/gcc/testsuite/g++.old-deja/g++.jason/template25.C new file mode 100644 index 000000000..5e876d995 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/template25.C @@ -0,0 +1,49 @@ +// { dg-do run } +// PRMS Id: 6393 +// Bug: g++ is too lax in considering UPTs to be the same. + +template +class Bar +{ +public: + R do_bar (T arg); +}; + + +template +class Foo +{ + T i; + +public: + void do_foo () {} + void do_foo (T const & t) {} + void do_foo (Bar const & bar); // {} Put the body here and it works + void do_foo (Bar const & bar); // {} Put the body here and it works +}; + +// These definitions don't work + +template +inline void Foo:: +do_foo (Bar const & bar) +{} + +template +inline void Foo:: +do_foo (Bar const & bar) +{} + + +int main () +{ int i; + Bar bar1; + Bar bar2; + Foo foo; + foo.do_foo(); + foo.do_foo(i); + foo.do_foo(bar1); + foo.do_foo(bar2); + + return 0; +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/template26.C b/gcc/testsuite/g++.old-deja/g++.jason/template26.C new file mode 100644 index 000000000..e7e3762b7 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/template26.C @@ -0,0 +1,115 @@ +// { dg-do run } +// PRMS Id: 6275 +// Bug: unification fails for call to find_parameter_in_stack. + +#include +#include + +const int max_stack_size = 20; + +template +class Stack { + private: + T objects[max_stack_size]; + int nobjects; + public: + Stack(): nobjects(0) {} + void push(const T&a) { + if (nobjects >= max_stack_size) { + fprintf(stderr,"Stack: overflow\n"); + abort(); + } + objects[nobjects++] = a; + } + T pop() { + if (!nobjects) { + fprintf(stderr,"Stack: underflow\n"); + abort(); + } + nobjects -= 1; + T result = objects[nobjects]; + return result; + } + T top() const { + if (!nobjects) { + fprintf(stderr,"Stack: underflow\n"); + abort(); + } + return objects[nobjects - 1]; + } + int n() const { return nobjects; } + T operator[](int i) { return objects[i]; } +}; + +template +class Parameter { + T parameter_; + int is_set_; + int overrides_; + public: + Parameter(): is_set_(0), overrides_(0) {} + void set(const T& a) { parameter_ = a; is_set_ = 1; } + void override(int overrides = 1) { overrides_ = overrides; } + const T& value() const { return parameter_; } + int overrides() const { return overrides_; } + int is_set() const { return is_set_; } +}; + +template +T2 +find_parameter_in_stack(Stack& stack, Parameter& (T1::*access)()) +{ + T2 result; + int have_result = 0; + for (int i=stack.n()-1; i>=0; i--) { + if ((stack[i].*access)().is_set()) { + if (!have_result || (stack[i].*access)().overrides()) { + result = (stack[i].*access)().value(); + have_result = 1; + } + } + } + return result; +} + +class A { + private: + Parameter a_; + public: + A() { } + Parameter& a() { return a_; } +}; + +int +main(int, char**) +{ + Stack A_stack; + A a1; + A a2; + a1.a().set(1); + a2.a().set(2); + A_stack.push(a1); + A_stack.push(a2); + + int val = find_parameter_in_stack(A_stack, &A::a); + + printf("val = %d\n", val); + if (val != 2) + return 1; + + A_stack.pop(); + A_stack.pop(); + + a1.a().override(); + + A_stack.push(a1); + A_stack.push(a2); + + val = find_parameter_in_stack(A_stack, &A::a); + + printf("val = %d\n", val); + if (val != 1) + return 1; + + return 0; +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/template27.C b/gcc/testsuite/g++.old-deja/g++.jason/template27.C new file mode 100644 index 000000000..a440397d7 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/template27.C @@ -0,0 +1,49 @@ +// { dg-do run } +// PRMS Id: 6826 +// Check that unnecessary templates are not instantiated. + +template +class Test +{ + public: + void doThiss(); + void doThat(); +}; + +template +void Test::doThiss() +{ + T x; + + x.thiss(); +} + +template +void Test::doThat() +{ + T x; + + x.that(); +} + +class A +{ + public: + void thiss() {} +}; + +class B +{ + public: + void that() {} +}; + +int main() +{ + Test a; + a.doThiss(); // a.doThat() is not well formed, but then + // it's not used so needn't be instantiated. + + Test b; + b.doThat(); // simillarly b.doThiss(); +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/template28.C b/gcc/testsuite/g++.old-deja/g++.jason/template28.C new file mode 100644 index 000000000..7359fa12d --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/template28.C @@ -0,0 +1,34 @@ +// { dg-do run } +// PRMS Id: 7179 + +template +class Car{ +public: + Car(); +} ; + +class Wheels{ +public: + Wheels(); +} ; + +class Shop +{ +public: + Shop(); +private: + Car car ; +} ; + +Wheels::Wheels() {} + +Shop::Shop() {} + +int main() +{ + Shop shop ; + return 0 ; +} + +template +Car::Car() {} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/template29.C b/gcc/testsuite/g++.old-deja/g++.jason/template29.C new file mode 100644 index 000000000..d971ab62d --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/template29.C @@ -0,0 +1,19 @@ +// { dg-do assemble } +// PRMS Id: 9500 + +template +class base + { +public: + inline base(); + }; + +template +class derived : public base + { +public: + inline derived(); + }; + +template +inline derived::derived() : base(){} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/template3.C b/gcc/testsuite/g++.old-deja/g++.jason/template3.C new file mode 100644 index 000000000..c26d58584 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/template3.C @@ -0,0 +1,15 @@ +// { dg-do run } +// PRMS Id: 4679 +// Bug: g++ doesn't re-instantiate templates after definition is seen. + +template struct A; + +A *a; + +template struct A { T t; }; + +int main() +{ + if (a) + a->t = 1; // { dg-bogus "" } +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/template30.C b/gcc/testsuite/g++.old-deja/g++.jason/template30.C new file mode 100644 index 000000000..9414c06ce --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/template30.C @@ -0,0 +1,15 @@ +// { dg-do assemble } +template +int func(U, T); // { dg-message "note" } + +template +int func(T, U) // { dg-message "note" } +{ + return 2; +} + +int main () +{ + func (0, 1); // { dg-error "ambiguous" } + // { dg-message "candidate" "candidate note" { target *-*-* } 13 } +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/template31.C b/gcc/testsuite/g++.old-deja/g++.jason/template31.C new file mode 100644 index 000000000..81d696f2f --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/template31.C @@ -0,0 +1,40 @@ +// { dg-do run } +// PRMS Id: 8569 + +#include +#include +#include + +using std::vector; + +class Component { + int george; + char mabel[128]; +}; +class CopyMe { +public: + CopyMe(){;} +private: + vector strvec; +}; + +class IncludeIt { +public: + IncludeIt() {} + ~IncludeIt() {} + IncludeIt(const IncludeIt& i) { + myStrvec = i.myStrvec; + } + IncludeIt& operator=(const IncludeIt& i) { + myStrvec = i.myStrvec; + return *this; + } +private: + CopyMe myStrvec; +}; + +int main(int argc, char**argv) { + IncludeIt foo; + IncludeIt* bar; + std::exit(0); +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/template32.C b/gcc/testsuite/g++.old-deja/g++.jason/template32.C new file mode 100644 index 000000000..3bbb6e8c5 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/template32.C @@ -0,0 +1,10 @@ +// { dg-do assemble } +// Bug: Instantiating A screws with class bindings for B + +template struct A { }; +struct B { + typedef int foo; + void f (); +}; + +void B::f () { A a; foo i; } diff --git a/gcc/testsuite/g++.old-deja/g++.jason/template33.C b/gcc/testsuite/g++.old-deja/g++.jason/template33.C new file mode 100644 index 000000000..af6072fd6 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/template33.C @@ -0,0 +1,17 @@ +// { dg-do assemble } +// Test nested enums in templates. + +template +class A +{ +public: + enum muni {X, Y}; + + muni e() { return X; } + muni f(); +}; + +template +typename A::muni A::f() { return X; } + +template class A; diff --git a/gcc/testsuite/g++.old-deja/g++.jason/template34.C b/gcc/testsuite/g++.old-deja/g++.jason/template34.C new file mode 100644 index 000000000..eaeb4641a --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/template34.C @@ -0,0 +1,25 @@ +// { dg-do run } +template +class Set { + public: + typedef int (*Compare)(const T&, const T&); + static Compare cmp1; + static int (*cmp2)(const T&, const T&); +}; + +template +int gen_cmp(const T& a, const T& b) { + if (a +typename Set::Compare Set::cmp1 = &gen_cmp; + +template +int (*Set::cmp2)(const T&, const T&) = &gen_cmp; + +int main() { + Set s; +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/template35.C b/gcc/testsuite/g++.old-deja/g++.jason/template35.C new file mode 100644 index 000000000..d2c1a3c57 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/template35.C @@ -0,0 +1,15 @@ +// { dg-do assemble } +// Bug: instantiation of D() corrupts declaration of basis[]. + +struct B { }; +template +struct D : public B +{ + D() : B () { } +}; + +B const * basis[] = +{ + new D<0>, + new D<1>, +}; diff --git a/gcc/testsuite/g++.old-deja/g++.jason/template36.C b/gcc/testsuite/g++.old-deja/g++.jason/template36.C new file mode 100644 index 000000000..23cdb00e6 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/template36.C @@ -0,0 +1,57 @@ +// { dg-do run } +// Testcase for implicit 'typename' and resolution of 'typename's in the +// current scope. + +class base1 { +public: + int bar() const + { return 1; } +}; + +class base2 { +public: + int bar() const + { return 0; } +}; + +template +struct base_trait { + typedef base1 base; +}; + +template<> +struct base_trait { + typedef base2 base; +}; + +template +class weird : public base_trait::base { +public: + typedef typename base_trait::base base; + + base f (); + int base::* g (); + + int zowee() const + { return this->bar(); } +}; + +template +typename weird::base weird::f () +{ + return base(); +} + +// The standard does not allow this case; the `typename' keyword may +// not appear in a ptr-operator. +#if 0 +template +int typename weird::base::* weird::g () +{ return 0; } +#endif + +int main() +{ + weird z; + return z.zowee() || z.f().bar(); +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/template39.C b/gcc/testsuite/g++.old-deja/g++.jason/template39.C new file mode 100644 index 000000000..51eace366 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/template39.C @@ -0,0 +1,22 @@ +// { dg-do assemble } +// PRMS Id: 10283 + +template struct B { + static void (*p)(); + static void f (); +}; + +template +void (*B::p)() = &B::f; + +B b; + +template struct A { + static const int j = i; + int k[j]; +}; + +A<1> a; + +template +const int A::j; diff --git a/gcc/testsuite/g++.old-deja/g++.jason/template4.C b/gcc/testsuite/g++.old-deja/g++.jason/template4.C new file mode 100644 index 000000000..de7d3312a --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/template4.C @@ -0,0 +1,21 @@ +// { dg-do assemble } +// Bug: g++ tries to instantiate ccList twice, and fails. + +template class ccHandle{ }; +template class ccList; +template class cc_List { +public: + ccList copy (); +}; + +template class ccList : public ccHandle < cc_List > { +public: + ccList (int); +}; + +template +ccList cc_List::copy (){} + +int main (int, char **) { + ccList size1(); +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/template40.C b/gcc/testsuite/g++.old-deja/g++.jason/template40.C new file mode 100644 index 000000000..e56833caa --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/template40.C @@ -0,0 +1,20 @@ +// { dg-do run } +// PRMS id: 11315 +// Bug: g++ doesn't recognize the copy ctor for Array. + +template +class Array { +public: + Array(int sz=12) + : ia (new Type[sz]), size(sz) {} + ~Array() { delete[] ia;} + Array(const Array& r) : size(0) {} // just for testing +private: + Type *ia; + int size; +}; + +int main(int argc, char *argv[]) +{ + Array ia; // looping occurs on this line +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/template41.C b/gcc/testsuite/g++.old-deja/g++.jason/template41.C new file mode 100644 index 000000000..a2f667f24 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/template41.C @@ -0,0 +1,34 @@ +// { dg-do run } +// PRMS Id: 11420 +// Bug: Can't handle indirect virtual template base init. + +extern "C" int printf (const char *, ...); + +template +class Vbase { + public: + Vbase(T i) { printf ("%d\n", i); } +}; + +template +class D1 : virtual public Vbase { + public: + D1(T i) : Vbase(i) {} +}; + +template +class D2 : virtual public Vbase { + public: + D2(T i) : Vbase(i) {} +}; + +template +class Most : public D1, public D2 { + public: + Most(T i) : D1(i), D2(i), Vbase(i) {} +}; + +int main () { + Most x(2); + return 0; +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/template42.C b/gcc/testsuite/g++.old-deja/g++.jason/template42.C new file mode 100644 index 000000000..63122ceb0 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/template42.C @@ -0,0 +1,19 @@ +// { dg-do run } +// Testcase for not evaluating template default args if they are +// never used. + +struct X { + X(int) { } +}; + +template +struct A { + void f (T t = T()) { } +}; + +int main () +{ + A a; + X x (1); + a.f (x); +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/template43.C b/gcc/testsuite/g++.old-deja/g++.jason/template43.C new file mode 100644 index 000000000..59641de85 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/template43.C @@ -0,0 +1,31 @@ +// { dg-do run } +// Test matching of partial specializations. + +template +class EQUAL { +public: + enum { value = 0 }; +}; +template +class EQUAL { +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 + +int main () +{ + if (equals_x_x == 1 + && equals_x_y == 0 + && equals_y_x == 0 + && equals_y_y == 1) + return 0; + return 1; +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/template44.C b/gcc/testsuite/g++.old-deja/g++.jason/template44.C new file mode 100644 index 000000000..2aea33a5e --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/template44.C @@ -0,0 +1,62 @@ +// { dg-do run } +#include +#include + +template +class List { +public: + int len; + T *array; + + int length() const { return( len ); } + + List() : len( 0 ), array( 0 ) {} +}; + +template +int AlgoStdCompare(const T* a, const T* b) { + if (*a < *b) + return -1; + else + return (*a > *b); // 0 if equal, 1 if greater +} + +int AlgoStdCompare(const char* const* a, const char * const*b) +{ + return strcmp(*a,*b); +} + +template +void AlgoFixupSort(List< T >* , int, int ) { +} + +template +void AlgoSort(int (*compare)(const T *, const T *), + void (*fixup)( List *, int first, int last), + List< T >* theList, int first, int last) { + if (last < 0) + last = theList->length()-1; + + qsort(theList->array+first, last-first+1, sizeof(T), + (int (*)(const void *, const void *))compare); + if (fixup) + fixup(theList, first, last); +} + +template +void AlgoSort(List< T >* theList, int first = 0, int last = -1) { + int (*compare)(const T*, const T*) = AlgoStdCompare; + void (*fixup)( List *, int first, int last) = AlgoFixupSort; + + AlgoSort(compare, fixup, theList, first, last); +} + +int +main() +{ + List slist; + AlgoSort( &slist ); + + List ilist; + AlgoSort( &ilist ); +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/template5.C b/gcc/testsuite/g++.old-deja/g++.jason/template5.C new file mode 100644 index 000000000..8401eafa9 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/template5.C @@ -0,0 +1,28 @@ +// { dg-do assemble } +// Bug: g++ fails to compare integer constants properly. + +template +struct Matrix { + int base [X] [Y]; +}; + +template +Matrix& Mul(Matrix& Q,Matrix& A,Matrix& B) { + for(int i=0;i q; + Matrix<2, 4> a; + Matrix<4, 3> b; + q = Mul (q, a, b); +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/template6.C b/gcc/testsuite/g++.old-deja/g++.jason/template6.C new file mode 100644 index 000000000..2aec05c81 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/template6.C @@ -0,0 +1,21 @@ +// { dg-do run } +// PRMS Id: 4656 +// Testcase for use of member pointers in template resolution + +template class A { + public: + A() : a(1) {} + T a; +}; + +template +int foo (T A::*p) +{ + return 0; +} +int main() +{ + int A::*pm = &A::a; // { dg-bogus "" } failed temp resolution + foo (pm); + return 0; +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/template7.C b/gcc/testsuite/g++.old-deja/g++.jason/template7.C new file mode 100644 index 000000000..1b563e619 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/template7.C @@ -0,0 +1,9 @@ +// { dg-do assemble } +// PRMS Id: 4826 + +class A; +template void f(const T&, const T&); + +void g (const A& a, A& b) { + f (a, b); // { dg-bogus "" } failed unification +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/template8.C b/gcc/testsuite/g++.old-deja/g++.jason/template8.C new file mode 100644 index 000000000..07c46ed0a --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/template8.C @@ -0,0 +1,10 @@ +// { dg-do assemble } +// PRMS Id: 4827 + +class A; +template int f (const T&, const A *); + +int g (const int& a) +{ + return f (a, (A *)0); // { dg-bogus "" } failed unification +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/template9.C b/gcc/testsuite/g++.old-deja/g++.jason/template9.C new file mode 100644 index 000000000..7a12ebf4a --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/template9.C @@ -0,0 +1,12 @@ +// { dg-do assemble } +// PRMS Id: 4864 +// Bug: g++ can't deal with a guiding declaration which comes before the +// template. + +void f (const int&, const int&); +template void f (const T&, const T&) { } + +void g (int a) +{ + f (a,a); // { dg-bogus "" } two identical candidates +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/temporary.C b/gcc/testsuite/g++.old-deja/g++.jason/temporary.C new file mode 100644 index 000000000..097507379 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/temporary.C @@ -0,0 +1,20 @@ +// { dg-do run } +// From: bruno@isoft.com.ar (Bruno R. Depascale) +// Subject: No destructor bug +// Date: Mon, 14 Feb 1994 12:49:45 -0300 (Arg) + +// Bug: temporaries created with constructor notation aren't destroyed. + +int count = 0; + +class A { +public: + A() { ++count; } + ~A() { --count; } +}; + +int main() +{ + A(); + return count; +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/temporary2.C b/gcc/testsuite/g++.old-deja/g++.jason/temporary2.C new file mode 100644 index 000000000..da216ae5c --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/temporary2.C @@ -0,0 +1,19 @@ +// { dg-do assemble } +class X // Indentation has been done so to see the similarities. +{ +public: + X() {} // { dg-message "note" } referenced below + X(X& x) {x.i=7;} // { dg-message "note" } Both functions modify the + void bar(X& x) {x.i=7;} // { dg-message "note" } reference parameter x. + int i; +}; + +X foo() { X x; return x; } + +int main() +{ + X x(foo()); // { dg-error "no match" } Compiler doesn't warn about temporary reference. + // { dg-message "candidate" "candidate note" { target *-*-* } 15 } + x.bar(foo()); // { dg-error "no match" } The same mistake is warned about in this case. + // { dg-message "candidate" "candidate note" { target *-*-* } 17 } +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/temporary3.C b/gcc/testsuite/g++.old-deja/g++.jason/temporary3.C new file mode 100644 index 000000000..7d96386b7 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/temporary3.C @@ -0,0 +1,27 @@ +// { dg-do run } +// 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; } + +int main () +{ + { + A a (1); + a = f (); + } + printf ("%d %d\n", c, d); + return c != d; +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/temporary4.C b/gcc/testsuite/g++.old-deja/g++.jason/temporary4.C new file mode 100644 index 000000000..2c8461221 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/temporary4.C @@ -0,0 +1,32 @@ +// { dg-do run } +// 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()) { } +}; + +int main() +{ + B b; + return r; +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/temporary5.C b/gcc/testsuite/g++.old-deja/g++.jason/temporary5.C new file mode 100644 index 000000000..5faad9f8e --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/temporary5.C @@ -0,0 +1,19 @@ +// PRMS Id: 6604 +// Old bug: Scoped constructor call is not properly recognized as a functional cast +// But after DR 147 A::A() is a constructor call, not a functional cast. + +int c; + +struct A { + A() { ++c; } + ~A() { --c; } + operator int () { return 1; } +}; + +int main () +{ + A a; + a.A::A(); // { dg-error "" } + A::A(); // { dg-message "" } + return c; +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/temporary6.C b/gcc/testsuite/g++.old-deja/g++.jason/temporary6.C new file mode 100644 index 000000000..dc660e8fc --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/temporary6.C @@ -0,0 +1,8 @@ +// { dg-do assemble } +// Bug: the temporary from the default parameter to f2 is reused. + +struct A {}; +int f2 (int i, const A& ar = A()); +void f (int i, int j = f2(1)); +void g () { f (1); } +void h () { f (1); } diff --git a/gcc/testsuite/g++.old-deja/g++.jason/temporary7.C b/gcc/testsuite/g++.old-deja/g++.jason/temporary7.C new file mode 100644 index 000000000..9a1b78956 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/temporary7.C @@ -0,0 +1,36 @@ +// { dg-do run } +// PRMS ID: 7304 + +struct V { + int n; + V() : n(0) { } + V(int x) : n(x) { } +}; + +V baz(const V &x) +{ + return x; +} + +int bar(V v1, V v2, V v3) +{ + return v1.n; +} + +struct A { + A(): n(7) { } + int foo(); + V n; +}; + +int A::foo() +{ + V v1, v2; + return bar(n, baz(v1), v2); +} + +int main() +{ + A a; + return (a.foo() != 7); +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/temporary8.C b/gcc/testsuite/g++.old-deja/g++.jason/temporary8.C new file mode 100644 index 000000000..c24256e6b --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/temporary8.C @@ -0,0 +1,26 @@ +// { dg-do run } +// Test for proper handling of temporaries in ?: exprs. + +extern "C" int printf (const char *, ...); +int c = 0, d = 0; + +class A { +public: + A() { ++c; } + A(const A&) { ++c; } + ~A() { ++d; } +}; + +A f (const A& a) +{ + return (c ? A() : A()); +} + +int main() +{ + { + f (c ? A() : A()); + } + printf ("%d %d\n", c, d); + return c != d || c != 2; +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/tempover.C b/gcc/testsuite/g++.old-deja/g++.jason/tempover.C new file mode 100644 index 000000000..5f56e4e88 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/tempover.C @@ -0,0 +1,14 @@ +// { dg-do assemble } +// GROUPS passed templates overloading +#define TEMPL template + +class B {}; + +TEMPL class A : virtual public B { + public: + A(int); +}; + +TEMPL A::A(int){} + +A a(1); diff --git a/gcc/testsuite/g++.old-deja/g++.jason/tempparse.C b/gcc/testsuite/g++.old-deja/g++.jason/tempparse.C new file mode 100644 index 000000000..1756a0c1c --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/tempparse.C @@ -0,0 +1,29 @@ +// { dg-do assemble } +/* + PRMS Id: 3631 + Bug is: g++ mangles template class names in a way that it won't accept, + and then tries to feed them to itself. +*/ + +template +struct A { + A(); +}; + +template +struct B : A { + B(); +}; // { dg-bogus "" } B> + +template +struct C { + C(); +}; + +template +struct D { + D(); + B > p_f; +}; + +typedef D Dummy; diff --git a/gcc/testsuite/g++.old-deja/g++.jason/tempsub.C b/gcc/testsuite/g++.old-deja/g++.jason/tempsub.C new file mode 100644 index 000000000..2a68add7c --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/tempsub.C @@ -0,0 +1,28 @@ +// { dg-do assemble } +// Distillation of crash1.C problem (PR 3633) + +template +class A +{ + P p; +}; + +template +class B +{ + A a; // bogus error - temp parm name propagating +}; + +template +class C +{ + B b; +}; + +template +class D +{ + S s; +}; + +C< D > c; diff --git a/gcc/testsuite/g++.old-deja/g++.jason/this.C b/gcc/testsuite/g++.old-deja/g++.jason/this.C new file mode 100644 index 000000000..17e897851 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/this.C @@ -0,0 +1,16 @@ +// { dg-do assemble } +// PRMS Id: 5190 +// Bug: g++ fails to build up a const reference to `this'. + +class X +{ +public: + void member (); +}; + +void print (const X* const &); + +void X::member () +{ + print (this); +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/thunk1.C b/gcc/testsuite/g++.old-deja/g++.jason/thunk1.C new file mode 100644 index 000000000..7de3c93e7 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/thunk1.C @@ -0,0 +1,47 @@ +// { dg-do run } +// Test that non-variadic function calls using thunks work right. + +struct A { + void* p; + A (void* q): p (q) { } + A (const A& a): p (a.p) { } +}; + +class CBase { +public: + virtual void BaseFunc(); +}; + +class MMixin { +public: + virtual A MixinFunc(int arg, A arg2) = 0; +}; + +class CExample : public CBase, public MMixin { +public: + A MixinFunc(int arg, A arg2); +}; + +void CBase::BaseFunc() +{ +} + +A CExample::MixinFunc(int arg, A arg2) +{ + if (arg != 1 || arg2.p != 0) + return 0; + return this; +} + +void* test(MMixin& anExample) +{ + return anExample.MixinFunc(1,A(0)).p; +} + +int main () +{ + CExample c; + + if (test(c) != &c) + return 1; +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/thunk2.C b/gcc/testsuite/g++.old-deja/g++.jason/thunk2.C new file mode 100644 index 000000000..88e06d876 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/thunk2.C @@ -0,0 +1,49 @@ +// { dg-do run { target fpic } } +// { dg-options "-fPIC" } +// { dg-skip-if "requires unsupported run-time relocation" { spu-*-* } { "*" } { "" } } +// Test that non-variadic function calls using thunks and PIC work right. + +struct A { + void* p; + A (void* q): p (q) { } + A (const A& a): p (a.p) { } +}; + +class CBase { +public: + virtual void BaseFunc(); +}; + +class MMixin { +public: + virtual A MixinFunc(int arg, A arg2) = 0; +}; + +class CExample : public CBase, public MMixin { +public: + A MixinFunc(int arg, A arg2); +}; + +void CBase::BaseFunc() +{ +} + +A CExample::MixinFunc(int arg, A arg2) +{ + if (arg != 1 || arg2.p != 0) + return 0; + return this; +} + +void* test(MMixin& anExample) +{ + return anExample.MixinFunc(1,A(0)).p; +} + +main () +{ + CExample c; + + if (test(c) != &c) + return 1; +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/thunk3.C b/gcc/testsuite/g++.old-deja/g++.jason/thunk3.C new file mode 100644 index 000000000..f0c1187b0 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/thunk3.C @@ -0,0 +1,59 @@ +// { dg-do run } +// { dg-skip-if "fails with generic thunk support" { rs6000-*-* powerpc-*-eabi v850-*-* sh-*-* sh64-*-* h8*-*-* xtensa*-*-* m32r*-*-* lm32-*-* } { "*" } { "" } } +// 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. + + +#include + +struct A { + void* p; + A (void* q): p (q) { } + A (const A& a): p (a.p) { } +}; + +class CBase { +public: + virtual void BaseFunc(); +}; + +class MMixin { +public: + virtual A MixinFunc(int arg, ...) = 0; +}; + +class CExample : public CBase, public MMixin { +public: + A MixinFunc(int arg, ...); +}; + +void CBase::BaseFunc() +{ +} + +A CExample::MixinFunc(int arg, ...) +{ + va_list ap; + va_start (ap, arg); + + if (arg != 1 || va_arg (ap, int) != 2 || va_arg (ap, int) != 3 + || va_arg (ap, int) != 4 || va_arg (ap, int) != 5 + || va_arg (ap, int) != 6 || va_arg (ap, int) != 7 + || va_arg (ap, int) != 8 || va_arg (ap, int) != 9) + return 0; + return this; +} + +void* test(MMixin& anExample) +{ + return anExample.MixinFunc(1,2,3,4,5,6,7,8,9).p; +} + +int main () +{ + CExample c; + + if (test(c) != &c) + return 1; +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/tredecl.C b/gcc/testsuite/g++.old-deja/g++.jason/tredecl.C new file mode 100644 index 000000000..df800603f --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/tredecl.C @@ -0,0 +1,17 @@ +// { dg-do assemble } +// Bug: Foo *p semi-instantiates Foo in local scope, so +// when Foo f tries to instantiate it later, it only finds the partial +// instantiation from before. +// +// No PR; distilled from James Clark's SGML project. +// + +class Bar { }; + +template class Foo; + +Foo *p; + +template class Foo { }; + +Foo f; // { dg-bogus "" } hosed binding levels diff --git a/gcc/testsuite/g++.old-deja/g++.jason/tredecl2.C b/gcc/testsuite/g++.old-deja/g++.jason/tredecl2.C new file mode 100644 index 000000000..6d354781a --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/tredecl2.C @@ -0,0 +1,5 @@ +// { dg-do assemble } +// No bug; making sure my fix for tredecl.C doesn't break other cases + +template struct Foo { Foo * me() { return this; } }; +Foo i; diff --git a/gcc/testsuite/g++.old-deja/g++.jason/tredecl3.C b/gcc/testsuite/g++.old-deja/g++.jason/tredecl3.C new file mode 100644 index 000000000..35c34d7e8 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/tredecl3.C @@ -0,0 +1,11 @@ +// { dg-do assemble } +// PRMS Id: 4679 +// Bug: redeclaration of templates erases the definition. + +template class Foo { public: void h(); }; +template class Foo; + +void g() +{ + Foo f; +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/tredecl4.C b/gcc/testsuite/g++.old-deja/g++.jason/tredecl4.C new file mode 100644 index 000000000..0fa6aef5f --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/tredecl4.C @@ -0,0 +1,6 @@ +// { dg-do assemble } +// It is illegal to use the name of a class template for anything else, +// including another class template. + +template class A { }; // { dg-message "previous" } +template class A { }; // { dg-error "redeclared" } diff --git a/gcc/testsuite/g++.old-deja/g++.jason/trivial.C b/gcc/testsuite/g++.old-deja/g++.jason/trivial.C new file mode 100644 index 000000000..13ef9dc61 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/trivial.C @@ -0,0 +1,71 @@ +// { dg-do assemble } +// PRMS Id: 3665 + +//------------------------------------------------------------- +// Referential declaration within class +// +// Imbeded below is the invocation of the compiler and the error +// message +// +// This compiles successfully with both the xlC and CFRONT compilers +// This was reviewed with Clem Dickey and we agree that it appears to +// be a Cygnus compiler problem. +//------------------------------------------------------------- +/* +$ make bug.reference.o + /usr/p3/bin/i960-vxworks-g++ `getsrc bug.reference.C` -I. -Iinc1 -Iinc2 + -I/vw5.0.3/h -I/vw5.0.3/h/i960 -I/usr/p3/lib/gcc-lib/i960-vxworks/cygnus-2.3.3 +/include -I/usr/p3/lib/gcc-lib/i960-vxworks/cygnus-2.3.3-930417/include -I/usr/p +3/lib/i960-vxworks/include -I/usr/p3/i960-vxworks/include -c -DCPU_FAMILY=I960 +-DCPU=I960CA -mca -mold-align -g3 -O1 -DASSERT_ON -nostdinc -nostdinc++ -MD +./bug.reference.C: In method `class1::class1 (long unsigned int, long unsigned i +nt **&)': +./bug.reference.C:43: cannot convert type `long unsigned int **' +./bug.reference.C:43: to type `long unsigned int *[]&' +make: 1254-004 The error code from the last command is 1. +*/ + +// typedefs +typedef unsigned long u32; +typedef u32 *ul[16]; + +// class defs +class class1 { + u32 var1; + class1(const class1 &); // Copy constructor + class1& operator=(const class1 &); // operator= member function +public: + class1(u32, ul&); + ul &ulref; + ~class1() {} +}; + + +// member function defs +class1::class1(u32 u, ul &l) : var1(u), ulref(l) +{} + +/* =========================================================================== +Note: The following is a "work around" that allows the successful compilation. + + +// typedefs +typedef unsigned long u32; +typedef u32 *ul[16]; + +// class defs +class class1 { + u32 var1; + class1(const class1 &); // Copy constructor + class1& operator=(const class1 &); // operator= member function +public: + class1(u32, ul*); + ul &ulref; + ~class1() {} +}; + + +// member function defs +class1::class1(u32 u, ul *l) : var1(u), ulref(*l) +{} +============================================================================*/ diff --git a/gcc/testsuite/g++.old-deja/g++.jason/typeck.C b/gcc/testsuite/g++.old-deja/g++.jason/typeck.C new file mode 100644 index 000000000..fc5134cb1 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/typeck.C @@ -0,0 +1,19 @@ +// { dg-do assemble } +// Bug: g++ fails to catch incompatibilities in the parameter lists when +// assigning. + +typedef struct S *type_p; +typedef struct S const *ctype_p; + +typedef ctype_p (*PF) (int); + +type_p callee (type_p arg) { return 0; } + +void foobar () +{ + static PF p = callee; // { dg-error "" } + + p = callee; // { dg-error "" } +} + +PF pp = callee; // { dg-error "" } diff --git a/gcc/testsuite/g++.old-deja/g++.jason/typedef.C b/gcc/testsuite/g++.old-deja/g++.jason/typedef.C new file mode 100644 index 000000000..9cbba5bce --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/typedef.C @@ -0,0 +1,10 @@ +// { dg-do assemble } +// PRMS Id: 4687 +// Bug: g++ misinterprets typedefs of function type in class scope. + +typedef int (*F1) (); +struct A { + typedef int F(); + F *fp; + F1 g() { return fp; } // { dg-bogus "" } typing +}; diff --git a/gcc/testsuite/g++.old-deja/g++.jason/typedef2.C b/gcc/testsuite/g++.old-deja/g++.jason/typedef2.C new file mode 100644 index 000000000..63c19bd16 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/typedef2.C @@ -0,0 +1,13 @@ +// { dg-do run } +// PRMS Id: 5367 +// Bug: the nested name of C::func gets hosed. + +struct C { + typedef int func(int *, int *); +}; + +int +main() +{ + C::func *handler; +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/typedef3.C b/gcc/testsuite/g++.old-deja/g++.jason/typedef3.C new file mode 100644 index 000000000..e9186103e --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/typedef3.C @@ -0,0 +1,8 @@ +// { dg-do assemble } +// Test that inheriting from a type typedefed to itself works. + +typedef struct class1 { + class1& operator=(const class1&); +} class1; + +class class2 : public class1 { }; diff --git a/gcc/testsuite/g++.old-deja/g++.jason/typeid1.C b/gcc/testsuite/g++.old-deja/g++.jason/typeid1.C new file mode 100644 index 000000000..ec5156e0c --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/typeid1.C @@ -0,0 +1,12 @@ +// { dg-do compile } +#include +#include + +struct foo { double f(int); }; + +int main() { + double f (int); + const std::type_info &r = typeid (f); + std::cout << typeid(f).name() << std::endl; + std::cout << typeid(foo::f).name() << std::endl; /* { dg-error "" } */ +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/typeid2.C b/gcc/testsuite/g++.old-deja/g++.jason/typeid2.C new file mode 100644 index 000000000..7914b677d --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/typeid2.C @@ -0,0 +1,31 @@ +// { dg-do run } +// PRMS Id: 11596 + +#include +extern "C" int printf (const char *, ...); + +class Chicken +{ +public: + int eggs_per_day; +}; + +template +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 ()); + } +}; + +int main() +{ + Flock x; + printf ("%s\n", typeid(x).name()); + x.head_count = 42; + x.print_self(); +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/union.C b/gcc/testsuite/g++.old-deja/g++.jason/union.C new file mode 100644 index 000000000..21a0b6f7a --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/union.C @@ -0,0 +1,11 @@ +// { dg-do assemble } +// Bug: g++ doesn't insert anon union members into class scope. +// Breaks groff. + +struct A { + union { + int i; + }; + + void foo () { i = 1; } // { dg-bogus "" } +}; diff --git a/gcc/testsuite/g++.old-deja/g++.jason/vecdel.C b/gcc/testsuite/g++.old-deja/g++.jason/vecdel.C new file mode 100644 index 000000000..6c6990933 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/vecdel.C @@ -0,0 +1,20 @@ +// { dg-do run } +__SIZE_TYPE__ newsize = 0; +__SIZE_TYPE__ delsize = 0; + +struct A { + int i; + void * operator new [] (__SIZE_TYPE__ i) + { newsize = i; return ::operator new [](i); } + void operator delete [] (void *p, __SIZE_TYPE__ i) + { delsize = i; ::operator delete [](p); } +}; + +int main() +{ + A* ap = new A [2]; + delete [] ap; + if (!newsize || newsize != delsize) + return 1; + return 0; +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/virtual.C b/gcc/testsuite/g++.old-deja/g++.jason/virtual.C new file mode 100644 index 000000000..34c92d8ba --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/virtual.C @@ -0,0 +1,41 @@ +// { dg-do assemble } +// 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. + +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() {} +}; + +int main() +{ + D d; // { dg-bogus "" } +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/virtual2.C b/gcc/testsuite/g++.old-deja/g++.jason/virtual2.C new file mode 100644 index 000000000..ffdd71c13 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/virtual2.C @@ -0,0 +1,14 @@ +// { dg-do run } +struct A { + virtual A* f () { return this; } +}; + +struct B: public A { + virtual B* f () { return 0; } +}; + +int main () +{ + A* ap = new B; + return (ap->f () != 0); +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/warning1.C b/gcc/testsuite/g++.old-deja/g++.jason/warning1.C new file mode 100644 index 000000000..6fa07ef0c --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/warning1.C @@ -0,0 +1,7 @@ +// { dg-do assemble } +// Bug: g++ protests that foo was never defined. + +static void foo (); +static void foo (); +static void foo () { } +void bar () { foo(); } // { dg-bogus "" } diff --git a/gcc/testsuite/g++.old-deja/g++.jason/warning10.C b/gcc/testsuite/g++.old-deja/g++.jason/warning10.C new file mode 100644 index 000000000..d9b8cb9bf --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/warning10.C @@ -0,0 +1,19 @@ +// { dg-do assemble } +// { dg-options "-W -Wall" } +// Don't warn about these comparisons. + +struct A { + unsigned int b : 14; +}; + +int f (int i, unsigned char u, A a, unsigned long ul) +{ + if ((u & 0x10) == 0) + return 1; + if (i == 0U) + return 1; + if (a.b > ul) + return 1; + + return 0; +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/warning2.C b/gcc/testsuite/g++.old-deja/g++.jason/warning2.C new file mode 100644 index 000000000..6298587e8 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/warning2.C @@ -0,0 +1,14 @@ +// { dg-do assemble } +// g++ ought to warn about casting a base pointer to a derived reference. + +struct A { + virtual void f () = 0; +}; + +struct B: public A { void f () { } }; + +int main() +{ + B* bp; + A& ar = (A&)bp; // { dg-warning "" } +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/warning3.C b/gcc/testsuite/g++.old-deja/g++.jason/warning3.C new file mode 100644 index 000000000..ef4a6eea9 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/warning3.C @@ -0,0 +1,12 @@ +// { dg-do assemble } +// { dg-options "-Wshadow" } +// Bug: overloading of 'A' for template causes bogus shadowing warnings. + +template +class A +{ + public: + virtual ~A() {} +}; + +template class A; diff --git a/gcc/testsuite/g++.old-deja/g++.jason/warning4.C b/gcc/testsuite/g++.old-deja/g++.jason/warning4.C new file mode 100644 index 000000000..9f50ff2c2 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/warning4.C @@ -0,0 +1,16 @@ +// { dg-do assemble } +// { dg-options "-Woverloaded-virtual" } +// Bug: a virtual function with the same name in an unrelated class will +// cause a bogus overloading warning. + +struct A { + virtual void foo (); +}; + +struct B { + virtual void bar (); +}; + +struct C: public A { + virtual void bar (); +}; diff --git a/gcc/testsuite/g++.old-deja/g++.jason/warning5.C b/gcc/testsuite/g++.old-deja/g++.jason/warning5.C new file mode 100644 index 000000000..006713c03 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/warning5.C @@ -0,0 +1,25 @@ +// { dg-do run } +// { dg-options "-Wall" } +// PRMS Id: 5135 +// Bug: g++ complains that the result of the new expression is not used. + +extern "C" int printf (const char *, ...); +inline void * operator new (__SIZE_TYPE__, void *p) { return p; } + +class foo { +public: + foo() : a(42) {}; + int a; +}; + +int +main() +{ + char buffer[1024]; + + new (buffer) foo; + + foo* pY = (foo *)buffer; + + return pY->a != 42; +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/warning6.C b/gcc/testsuite/g++.old-deja/g++.jason/warning6.C new file mode 100644 index 000000000..08acb7247 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/warning6.C @@ -0,0 +1,7 @@ +// { dg-do assemble } +// { dg-options "-Wunused" } + +struct A { + int i:8; + virtual ~A() {} +}; diff --git a/gcc/testsuite/g++.old-deja/g++.jason/warning7.C b/gcc/testsuite/g++.old-deja/g++.jason/warning7.C new file mode 100644 index 000000000..06eec9b55 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/warning7.C @@ -0,0 +1,6 @@ +// { dg-do assemble } +// { dg-options "-Wunused" } +// PRMS Id: 5481 + +struct A { }; +static A a = A(); diff --git a/gcc/testsuite/g++.old-deja/g++.jason/warning8.C b/gcc/testsuite/g++.old-deja/g++.jason/warning8.C new file mode 100644 index 000000000..b5ff3f3de --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/warning8.C @@ -0,0 +1,17 @@ +// { dg-do assemble } + +struct A { + A(); + ~A(); +}; + +struct B { + B (const A&); + ~B (); +}; + +const B& f () +{ + A a; + return a; // { dg-warning "" } returning reference to temporary +} diff --git a/gcc/testsuite/g++.old-deja/g++.jason/warning9.C b/gcc/testsuite/g++.old-deja/g++.jason/warning9.C new file mode 100644 index 000000000..775a37ca3 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/warning9.C @@ -0,0 +1,15 @@ +// { dg-do assemble } +// { dg-options "-Wsynth" } + +struct A { + operator int (); + A& operator= (int); +}; + +int +main() +{ + A a, b; + + a = b; +} -- cgit v1.2.3