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++.benjamin/13478.C | 30 +++ gcc/testsuite/g++.old-deja/g++.benjamin/13523.C | 12 ++ gcc/testsuite/g++.old-deja/g++.benjamin/13908.C | 21 +++ gcc/testsuite/g++.old-deja/g++.benjamin/14139.C | 22 +++ gcc/testsuite/g++.old-deja/g++.benjamin/14664-1.C | 15 ++ gcc/testsuite/g++.old-deja/g++.benjamin/14664-2.C | 14 ++ gcc/testsuite/g++.old-deja/g++.benjamin/14687.C | 53 ++++++ gcc/testsuite/g++.old-deja/g++.benjamin/15054.C | 10 + gcc/testsuite/g++.old-deja/g++.benjamin/15071.C | 12 ++ gcc/testsuite/g++.old-deja/g++.benjamin/15309-1.C | 21 +++ gcc/testsuite/g++.old-deja/g++.benjamin/15309-2.C | 10 + gcc/testsuite/g++.old-deja/g++.benjamin/15756-1.C | 36 ++++ gcc/testsuite/g++.old-deja/g++.benjamin/15756-2.C | 50 +++++ gcc/testsuite/g++.old-deja/g++.benjamin/15799.C | 30 +++ gcc/testsuite/g++.old-deja/g++.benjamin/15800-1.C | 18 ++ gcc/testsuite/g++.old-deja/g++.benjamin/15800-2.C | 18 ++ gcc/testsuite/g++.old-deja/g++.benjamin/15822.C | 28 +++ gcc/testsuite/g++.old-deja/g++.benjamin/16077.C | 31 +++ gcc/testsuite/g++.old-deja/g++.benjamin/16567.C | 44 +++++ gcc/testsuite/g++.old-deja/g++.benjamin/17922.C | 19 ++ gcc/testsuite/g++.old-deja/g++.benjamin/17930.C | 6 + gcc/testsuite/g++.old-deja/g++.benjamin/18208.C | 25 +++ gcc/testsuite/g++.old-deja/g++.benjamin/bool01.C | 80 ++++++++ gcc/testsuite/g++.old-deja/g++.benjamin/bool02.C | 64 +++++++ gcc/testsuite/g++.old-deja/g++.benjamin/friend01.C | 31 +++ gcc/testsuite/g++.old-deja/g++.benjamin/friend02.C | 31 +++ gcc/testsuite/g++.old-deja/g++.benjamin/p12475.C | 14 ++ gcc/testsuite/g++.old-deja/g++.benjamin/p13417.C | 11 ++ gcc/testsuite/g++.old-deja/g++.benjamin/p13721.C | 21 +++ gcc/testsuite/g++.old-deja/g++.benjamin/scope01.C | 71 +++++++ gcc/testsuite/g++.old-deja/g++.benjamin/scope02.C | 208 ++++++++++++++++++++ gcc/testsuite/g++.old-deja/g++.benjamin/tem01.C | 136 ++++++++++++++ gcc/testsuite/g++.old-deja/g++.benjamin/tem02.C | 54 ++++++ gcc/testsuite/g++.old-deja/g++.benjamin/tem03.C | 209 +++++++++++++++++++++ gcc/testsuite/g++.old-deja/g++.benjamin/tem04.C | 182 ++++++++++++++++++ gcc/testsuite/g++.old-deja/g++.benjamin/tem05.C | 58 ++++++ gcc/testsuite/g++.old-deja/g++.benjamin/tem06.C | 52 +++++ gcc/testsuite/g++.old-deja/g++.benjamin/tem07.C | 38 ++++ .../g++.old-deja/g++.benjamin/typedef01.C | 46 +++++ .../g++.old-deja/g++.benjamin/typedef03.C | 44 +++++ gcc/testsuite/g++.old-deja/g++.benjamin/typeid01.C | 72 +++++++ gcc/testsuite/g++.old-deja/g++.benjamin/warn01.C | 98 ++++++++++ gcc/testsuite/g++.old-deja/g++.benjamin/warn02.C | 54 ++++++ gcc/testsuite/g++.old-deja/g++.benjamin/warn03.C | 10 + gcc/testsuite/g++.old-deja/g++.benjamin/warn04.C | 9 + 45 files changed, 2118 insertions(+) create mode 100644 gcc/testsuite/g++.old-deja/g++.benjamin/13478.C create mode 100644 gcc/testsuite/g++.old-deja/g++.benjamin/13523.C create mode 100644 gcc/testsuite/g++.old-deja/g++.benjamin/13908.C create mode 100644 gcc/testsuite/g++.old-deja/g++.benjamin/14139.C create mode 100644 gcc/testsuite/g++.old-deja/g++.benjamin/14664-1.C create mode 100644 gcc/testsuite/g++.old-deja/g++.benjamin/14664-2.C create mode 100644 gcc/testsuite/g++.old-deja/g++.benjamin/14687.C create mode 100644 gcc/testsuite/g++.old-deja/g++.benjamin/15054.C create mode 100644 gcc/testsuite/g++.old-deja/g++.benjamin/15071.C create mode 100644 gcc/testsuite/g++.old-deja/g++.benjamin/15309-1.C create mode 100644 gcc/testsuite/g++.old-deja/g++.benjamin/15309-2.C create mode 100644 gcc/testsuite/g++.old-deja/g++.benjamin/15756-1.C create mode 100644 gcc/testsuite/g++.old-deja/g++.benjamin/15756-2.C create mode 100644 gcc/testsuite/g++.old-deja/g++.benjamin/15799.C create mode 100644 gcc/testsuite/g++.old-deja/g++.benjamin/15800-1.C create mode 100644 gcc/testsuite/g++.old-deja/g++.benjamin/15800-2.C create mode 100644 gcc/testsuite/g++.old-deja/g++.benjamin/15822.C create mode 100644 gcc/testsuite/g++.old-deja/g++.benjamin/16077.C create mode 100644 gcc/testsuite/g++.old-deja/g++.benjamin/16567.C create mode 100644 gcc/testsuite/g++.old-deja/g++.benjamin/17922.C create mode 100644 gcc/testsuite/g++.old-deja/g++.benjamin/17930.C create mode 100644 gcc/testsuite/g++.old-deja/g++.benjamin/18208.C create mode 100644 gcc/testsuite/g++.old-deja/g++.benjamin/bool01.C create mode 100644 gcc/testsuite/g++.old-deja/g++.benjamin/bool02.C create mode 100644 gcc/testsuite/g++.old-deja/g++.benjamin/friend01.C create mode 100644 gcc/testsuite/g++.old-deja/g++.benjamin/friend02.C create mode 100644 gcc/testsuite/g++.old-deja/g++.benjamin/p12475.C create mode 100644 gcc/testsuite/g++.old-deja/g++.benjamin/p13417.C create mode 100644 gcc/testsuite/g++.old-deja/g++.benjamin/p13721.C create mode 100644 gcc/testsuite/g++.old-deja/g++.benjamin/scope01.C create mode 100644 gcc/testsuite/g++.old-deja/g++.benjamin/scope02.C create mode 100644 gcc/testsuite/g++.old-deja/g++.benjamin/tem01.C create mode 100644 gcc/testsuite/g++.old-deja/g++.benjamin/tem02.C create mode 100644 gcc/testsuite/g++.old-deja/g++.benjamin/tem03.C create mode 100644 gcc/testsuite/g++.old-deja/g++.benjamin/tem04.C create mode 100644 gcc/testsuite/g++.old-deja/g++.benjamin/tem05.C create mode 100644 gcc/testsuite/g++.old-deja/g++.benjamin/tem06.C create mode 100644 gcc/testsuite/g++.old-deja/g++.benjamin/tem07.C create mode 100644 gcc/testsuite/g++.old-deja/g++.benjamin/typedef01.C create mode 100644 gcc/testsuite/g++.old-deja/g++.benjamin/typedef03.C create mode 100644 gcc/testsuite/g++.old-deja/g++.benjamin/typeid01.C create mode 100644 gcc/testsuite/g++.old-deja/g++.benjamin/warn01.C create mode 100644 gcc/testsuite/g++.old-deja/g++.benjamin/warn02.C create mode 100644 gcc/testsuite/g++.old-deja/g++.benjamin/warn03.C create mode 100644 gcc/testsuite/g++.old-deja/g++.benjamin/warn04.C (limited to 'gcc/testsuite/g++.old-deja/g++.benjamin') diff --git a/gcc/testsuite/g++.old-deja/g++.benjamin/13478.C b/gcc/testsuite/g++.old-deja/g++.benjamin/13478.C new file mode 100644 index 000000000..e1d52e14b --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.benjamin/13478.C @@ -0,0 +1,30 @@ +// { dg-do assemble } +// 981203 bkoz +// g++/13478 + +class A {}; +class AData {}; + +typedef void (A::* hand) (void); + +struct hand_table { + const int data1; + const hand data2; +}; + +class Agent : public A { +public: + enum { first = 1, last }; +protected: + static const hand_table table_1[]; + static const AData table_2; +private: + void foo (void); +}; + +const hand_table Agent::table_1[] = +{ + {0, &Agent::table_2}, + {first, &Agent::foo}, + {last, &(hand)Agent::foo} // { dg-error "" } no match +}; diff --git a/gcc/testsuite/g++.old-deja/g++.benjamin/13523.C b/gcc/testsuite/g++.old-deja/g++.benjamin/13523.C new file mode 100644 index 000000000..d70e04a98 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.benjamin/13523.C @@ -0,0 +1,12 @@ +// { dg-do assemble } +// 981203 bkoz +// g++/13523 + +template class latin_america; + +class peru +{ + friend class latin_america; // Particular template class friend works + template friend class latin_america; // This does not work. +}; + diff --git a/gcc/testsuite/g++.old-deja/g++.benjamin/13908.C b/gcc/testsuite/g++.old-deja/g++.benjamin/13908.C new file mode 100644 index 000000000..d18434eca --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.benjamin/13908.C @@ -0,0 +1,21 @@ +// { dg-do assemble } +// 981203 bkoz +// g++/13908 + +class chile +{ +public: +protected: +private: +}; + +typedef void (chile::* pmf) (); + +void* foo; + +void bar (chile* pobj, pmf pmethod) +{ + //-edg: expected member name + //-g++: taking address of bound pointer-to-member expression + foo = (void*) &(pobj->*pmethod); // { dg-error "invalid use" } +} diff --git a/gcc/testsuite/g++.old-deja/g++.benjamin/14139.C b/gcc/testsuite/g++.old-deja/g++.benjamin/14139.C new file mode 100644 index 000000000..2429538f3 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.benjamin/14139.C @@ -0,0 +1,22 @@ +// { dg-do assemble } +// 981203 bkoz +// g++/14309 +// test for global functions, mf's, and templatized mf's. + +static int fooe_1(void) { return 5; } +static int fooe_2(int x = fooe_1()) { return x; } + +struct antigua { + static int& foo_1(); + static int foo_2(int& x = antigua::foo_1()); + static int foo_3(int x = fooe_2()); +}; + +template + struct jamacia { + static int& foo_1(); + static int foo_2(int& x = antigua::foo_1()); + static int foo_3(int x = fooe_2()); + }; + +template class jamacia; diff --git a/gcc/testsuite/g++.old-deja/g++.benjamin/14664-1.C b/gcc/testsuite/g++.old-deja/g++.benjamin/14664-1.C new file mode 100644 index 000000000..9a6e64443 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.benjamin/14664-1.C @@ -0,0 +1,15 @@ +// { dg-do assemble } +// 981203 bkoz +// g++/14664 - test + +char foo[26]; + +void bar() +{ + //-g++: incompatible types in assignment of 'const char[]' to 'char[]' + //-edg: expression must be a modifiable lvalue + foo = "0123456789012345678901234"; // { dg-error "" } // ERROR - +} + + + diff --git a/gcc/testsuite/g++.old-deja/g++.benjamin/14664-2.C b/gcc/testsuite/g++.old-deja/g++.benjamin/14664-2.C new file mode 100644 index 000000000..364f30c4b --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.benjamin/14664-2.C @@ -0,0 +1,14 @@ +// { dg-do assemble } +// { dg-options "-fpermissive -w" } +// 981203 bkoz +// g++/14664 + test + +char foo[26]; + +void bar() +{ + foo = "0123456789012345678901234"; // { dg-error "array" } +} + + + diff --git a/gcc/testsuite/g++.old-deja/g++.benjamin/14687.C b/gcc/testsuite/g++.old-deja/g++.benjamin/14687.C new file mode 100644 index 000000000..494f75c56 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.benjamin/14687.C @@ -0,0 +1,53 @@ +// { dg-do run } +// 981203 bkoz +// g++/14687 + +#include +unsigned int gtest; + +// 7.3.3 the using declaration + +// p 3 +struct belieze { + void f(char); + void g(char); + enum E { e }; + union { int x; }; +}; + +struct dominica: belieze { + using belieze::f; + void f(int i) { f('c'); } // calls belieze::f(char) + void g(int i) { g('c'); } // recursively calls dominca::g(int) +}; + + +// p 6 +namespace A { + void f(int i) { gtest = 1; } +} + +using A::f; //f is a synonym for A::f, that is for A::f(int) + +namespace A { + void f(char c) { gtest = 3; } +} + +void foo(void) { + f('a'); //calls f(int), even though A::f(char) exits + assert (gtest = 1); +} + +void bar(void) { + using A::f; //f is a synonm for A::f, that is for A::f(int) and A::f(char) + f('a'); //calls f(char) + assert (gtest = 3); +} + +int main(void) +{ + foo(); + bar(); + + return 0; +} diff --git a/gcc/testsuite/g++.old-deja/g++.benjamin/15054.C b/gcc/testsuite/g++.old-deja/g++.benjamin/15054.C new file mode 100644 index 000000000..4d1c6f207 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.benjamin/15054.C @@ -0,0 +1,10 @@ +// { dg-do assemble } +// { dg-options "-Wno-pointer-arith" } +// 981203 bkoz +// g++/15054 +// note that -pedantic also turns on this warning + +void cuba(void) { + void* p; + p++; +} diff --git a/gcc/testsuite/g++.old-deja/g++.benjamin/15071.C b/gcc/testsuite/g++.old-deja/g++.benjamin/15071.C new file mode 100644 index 000000000..d05f48f50 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.benjamin/15071.C @@ -0,0 +1,12 @@ +// { dg-do run } +// 981203 bkoz +// g++/15071 +// gcc invocation fails to link in libstdc++ + +#include + +int main() { + std::cout << "hi" << std::endl; + + return 0; +} diff --git a/gcc/testsuite/g++.old-deja/g++.benjamin/15309-1.C b/gcc/testsuite/g++.old-deja/g++.benjamin/15309-1.C new file mode 100644 index 000000000..aa5530fff --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.benjamin/15309-1.C @@ -0,0 +1,21 @@ +// { dg-do assemble } +// { dg-options "-Wnon-virtual-dtor -Weffc++" } +// 981203 bkoz +// g++/15309 + +class bahamian { +public: + bahamian (); + ~bahamian (); +}; + +class miami : public bahamian // { dg-warning "" } // WARNING - +{ +public: + miami (); + ~miami (); +}; + + + + diff --git a/gcc/testsuite/g++.old-deja/g++.benjamin/15309-2.C b/gcc/testsuite/g++.old-deja/g++.benjamin/15309-2.C new file mode 100644 index 000000000..283179731 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.benjamin/15309-2.C @@ -0,0 +1,10 @@ +// { dg-do assemble } +// { dg-options "-Wnon-virtual-dtor -Weffc++" } +// 981203 bkoz +// g++/15309 + +class bermuda { // { dg-warning "" } // WARNING - +public: + virtual int func1(int); + ~bermuda(); +}; diff --git a/gcc/testsuite/g++.old-deja/g++.benjamin/15756-1.C b/gcc/testsuite/g++.old-deja/g++.benjamin/15756-1.C new file mode 100644 index 000000000..2bef3b0f1 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.benjamin/15756-1.C @@ -0,0 +1,36 @@ +// { dg-do assemble } +// { dg-options "-Wsign-promo" } +// 981203 bkoz +// g++/15756 test1 + +enum e_value { first = 0, next = 30 }; + +struct sanjuan { + sanjuan(int value); + sanjuan(unsigned value); + friend sanjuan operator&(const sanjuan& x, const sanjuan& y); + friend int operator!=(const sanjuan& x, const sanjuan& y); +}; + +extern void mod_enum(e_value*); +extern int a; + +void foo(void) { + e_value mod = first; + mod_enum(&mod); + if (mod != next) + ++a; +} + + + + + + + + + + + + + diff --git a/gcc/testsuite/g++.old-deja/g++.benjamin/15756-2.C b/gcc/testsuite/g++.old-deja/g++.benjamin/15756-2.C new file mode 100644 index 000000000..77c4aca35 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.benjamin/15756-2.C @@ -0,0 +1,50 @@ +// { dg-do assemble } +// { dg-options "-Wsign-promo" } +// 981203 bkoz +// g++/15756 test2 +// this test may only be valid for 32bit targets at present + +#include + +enum e_i { + vali +} +enum_int; + +enum e_ui { +#if INT_MAX == 32767 + valui = 0xF234 +#else + valui = 0xF2345678 +#endif +} +enum_uint; + +int i; +unsigned int ui; + +struct caracas { + caracas(int); + caracas(unsigned int); + void foo(); +}; + +int main () +{ + caracas obj_ei ( enum_int ); // { dg-warning "" } + caracas obj_eui ( enum_uint ); // { dg-warning "" } + caracas obj_i ( i ); + caracas obj_ui ( ui ); + + obj_ei.foo(); + obj_eui.foo(); + obj_i.foo(); + obj_ui.foo(); +} + + + + + + + diff --git a/gcc/testsuite/g++.old-deja/g++.benjamin/15799.C b/gcc/testsuite/g++.old-deja/g++.benjamin/15799.C new file mode 100644 index 000000000..24725c999 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.benjamin/15799.C @@ -0,0 +1,30 @@ +// { dg-do assemble } +// 981203 bkoz +// g++/15799 test1 + +/* +15799.cpp: In function `void foo()': +15799.cpp:21: call of overloaded `sanjose({anonymous enum})' is ambiguous +15799.cpp:13: candidates are: sanjose::sanjose(const sanjose &) +15799.cpp:14: sanjose::sanjose(unsigned int) +*/ + +typedef char int_8; +typedef unsigned long uint_32; + +class sanjose { +public: + sanjose(); + sanjose(const sanjose&); // { dg-message "note" } + sanjose(int_8 value); // { dg-message "note" } + sanjose(uint_32 value); // { dg-message "note" } +}; + +enum { first, last}; + +void foo(void) { + sanjose obj(first); // { dg-error "ambiguous" } + // { dg-message "candidate" "candidate note" { target *-*-* } 26 } +} + + diff --git a/gcc/testsuite/g++.old-deja/g++.benjamin/15800-1.C b/gcc/testsuite/g++.old-deja/g++.benjamin/15800-1.C new file mode 100644 index 000000000..4f6d878e8 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.benjamin/15800-1.C @@ -0,0 +1,18 @@ +// { dg-do assemble } +// 981203 bkoz +// g++/15800 - test + +struct panama { + panama(); + panama(panama &); + panama& operator=(panama&); // { dg-message "operator=|no known conversion" } +}; + +extern panama dig(); + +void foo() { + panama obj; + obj = dig(); // { dg-error "no match" } + // { dg-message "candidate" "candidate note" { target *-*-* } 15 } +} + diff --git a/gcc/testsuite/g++.old-deja/g++.benjamin/15800-2.C b/gcc/testsuite/g++.old-deja/g++.benjamin/15800-2.C new file mode 100644 index 000000000..6149da6be --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.benjamin/15800-2.C @@ -0,0 +1,18 @@ +// { dg-do assemble } +// 981203 bkoz +// g++/15800 + test + +struct panama { + panama(); + panama(panama &); + panama& operator=(panama&); + panama& getref() { return *this; } +}; + +extern panama dig(); + +void foo() { + panama obj; + obj = dig().getref(); +} + diff --git a/gcc/testsuite/g++.old-deja/g++.benjamin/15822.C b/gcc/testsuite/g++.old-deja/g++.benjamin/15822.C new file mode 100644 index 000000000..ff9b59366 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.benjamin/15822.C @@ -0,0 +1,28 @@ +// { dg-do run } +// 981203 bkoz +// g++/15822 + +#include + +static unsigned int gcount; + +struct playahermosa { + playahermosa() { ++gcount; } + playahermosa(const playahermosa &) { ++gcount; } + ~playahermosa() { --gcount; } +}; + +struct playacoco { + playacoco(const playahermosa& = playahermosa()) { } //create a temporary +}; + +void foo(playacoco *) { } + +int main() +{ + playacoco bar[2]; + foo(bar); + assert (gcount == 0); + + return 0; +} diff --git a/gcc/testsuite/g++.old-deja/g++.benjamin/16077.C b/gcc/testsuite/g++.old-deja/g++.benjamin/16077.C new file mode 100644 index 000000000..9338e8755 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.benjamin/16077.C @@ -0,0 +1,31 @@ +// { dg-do assemble } +// 981203 bkoz +// g++/16077 +// { dg-options "-Wconversion" } + +class nicaragua; +struct colombia { + colombia(); + colombia(const colombia &); + colombia(const nicaragua &); + colombia &operator= (const colombia&); +}; + +struct nicaragua { +public: + nicaragua(); + nicaragua(const nicaragua&); + operator colombia(); +}; + +void peace(const colombia&); + +void foo(nicaragua& b) { + peace(b); // { dg-warning "choosing 'nicaragua::operator" "nic" } + // { dg-warning "conversion" "conv" { target *-*-* } 24 } + // { dg-message "note" "note" { target *-*-* } 24 } +} + + + + diff --git a/gcc/testsuite/g++.old-deja/g++.benjamin/16567.C b/gcc/testsuite/g++.old-deja/g++.benjamin/16567.C new file mode 100644 index 000000000..7b4f68bbe --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.benjamin/16567.C @@ -0,0 +1,44 @@ +// { dg-do assemble } +// 981203 bkoz +// g++/16567 + +typedef bool Bool; +typedef unsigned char Uint8; +typedef unsigned short Uint16; +typedef unsigned int Uint32; + +enum e_ms { third = 3, fourth = 4 }; + +struct bitmask { + Uint8* anon1; + Uint32 anon2; + Uint8 anon3; + Uint8 here: 2; + Uint8 anon4: 2; + Uint8 anon5: 4; +}; + +struct control { + Uint8 foo_1(); +}; + +inline Uint8 foo_2(bitmask* p) { + return p->here; +} + +inline Uint8 control::foo_1() { + return foo_2((bitmask*) this); +} + +void foo(void) { + control obj; + control *fp = &obj; + e_ms result; + + result = (e_ms) fp->foo_1; // { dg-error "" } // ERROR - +} + + + + + diff --git a/gcc/testsuite/g++.old-deja/g++.benjamin/17922.C b/gcc/testsuite/g++.old-deja/g++.benjamin/17922.C new file mode 100644 index 000000000..2fc6204e9 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.benjamin/17922.C @@ -0,0 +1,19 @@ +// { dg-do assemble } +// 981204 bkoz +// g++/17922 + +class base { }; + +struct derived : public base { + derived (const derived&); + derived (const base&); +}; + +class tahiti { +public: + static void mf (derived); +}; + +void foo (const derived aaa) { + tahiti::mf(aaa); +} diff --git a/gcc/testsuite/g++.old-deja/g++.benjamin/17930.C b/gcc/testsuite/g++.old-deja/g++.benjamin/17930.C new file mode 100644 index 000000000..b9b28524f --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.benjamin/17930.C @@ -0,0 +1,6 @@ +// { dg-do assemble } +// 981204 bkoz +// g++/17930 + +char const one[] = "test"; +char const two[] = one; // { dg-error "" } // ERROR - diff --git a/gcc/testsuite/g++.old-deja/g++.benjamin/18208.C b/gcc/testsuite/g++.old-deja/g++.benjamin/18208.C new file mode 100644 index 000000000..2e9b7ce7a --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.benjamin/18208.C @@ -0,0 +1,25 @@ +// { dg-do assemble } +// 981204 bkoz +// g++/18208 + +typedef unsigned int uint_32; + +class puertorico { +public: + void *f (); +private: + uint_32 member; +}; + +void foo( ) +{ + uint_32 ui; + puertorico obj; + + // Bug using static_cast<> + ui = static_cast(obj); // { dg-error "" } // ERROR - + + // Bug when missing the pair of braces + ui = (uint_32) obj.f; // { dg-error "" } // ERROR - +} + diff --git a/gcc/testsuite/g++.old-deja/g++.benjamin/bool01.C b/gcc/testsuite/g++.old-deja/g++.benjamin/bool01.C new file mode 100644 index 000000000..b9890412d --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.benjamin/bool01.C @@ -0,0 +1,80 @@ +// { dg-do run } +//980323 bkoz +//test for bools with inclusive ors + +#include +#include + +void bar ( bool x ) {} +void bars ( short x ) {} + +/* 980326 bkoz this is not initialized and so can have indeterminate value. */ +#if 0 +int orb(){ + bool y; + bar ( y ); + int blob = ( 27 | int (y) ); + return blob; //expect 27 or 0 +} +#endif + +int orbtrue(){ + bool y = true; + bar ( y ); + int blob = ( 27 | int (y) ); + return blob; //expect 27 +} + +int orbfalse(){ + bool y = false; + bar ( y ); + int blob = ( 27 | int (y) ); + return blob; //expect 27 +} + +int orbfalse2(){ + bool y = 0; + bar ( y ); + int blob = ( 27 | int (y) ); + return blob; //expect 27 +} + +int ors(){ + short y = 1; + bars ( y ); + int blob = ( 27 | int (y) ); + return blob; //expect 27 +} + + +#if INT_MAX > 32767 +int orus(){ + unsigned short y = 1; + bars ( y ); + int blob = ( 65539 | int (y) ); + return blob; //expect 65539, will be 3 if done in us type +} +#endif + +int main() { + int tmp; +#if 0 + tmp = orb(); + assert (tmp == 27 || tmp == 0); +#endif + tmp = orbtrue(); + assert (tmp ==27); + tmp = orbfalse(); + assert (tmp ==27); + tmp = orbfalse2(); + assert (tmp ==27); + tmp = ors(); + assert (tmp ==27); +#if INT_MAX > 32767 + tmp = orus(); + assert (tmp == 65539); +#endif + + return 0; +} + diff --git a/gcc/testsuite/g++.old-deja/g++.benjamin/bool02.C b/gcc/testsuite/g++.old-deja/g++.benjamin/bool02.C new file mode 100644 index 000000000..fcdb143a1 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.benjamin/bool02.C @@ -0,0 +1,64 @@ +// { dg-do run } +//980324 bkoz +//test for bool and bitwise ands + +#include + + +void bar ( bool x ) {} +void bars ( short x ) {} + +#if 0 +int andb(){ + bool y; + bar ( y ); + int blob = ( 27 & int (y) ); + return blob; //expect 1 or 0 +} +#endif + +int andbtrue(){ + bool y = true; + bar ( y ); + int blob = ( 27 & int (y) ); + return blob; //expect 1 +} + +int andbfalse(){ + bool y = false; + bar ( y ); + int blob = ( 27 & int (y) ); + return blob; //expect 0 +} + +int andbfalse2(){ + bool y = 0; + bar ( y ); + int blob = ( 27 & int (y) ); + return blob; //expect 0 +} + +int ands(){ + short y = 1; + bars ( y ); + int blob = ( 27 & int (y) ); + return blob; //expect 1 +} + + +int main() { + int tmp; +#if 0 + tmp = andb(); + assert (tmp == 1 || tmp == 0); +#endif + tmp = andbtrue(); + assert (tmp == 1); + tmp = andbfalse(); + assert (tmp == 0); + tmp = andbfalse2(); + assert (tmp == 0); + tmp = ands(); + assert (tmp == 1); + return 0; +} diff --git a/gcc/testsuite/g++.old-deja/g++.benjamin/friend01.C b/gcc/testsuite/g++.old-deja/g++.benjamin/friend01.C new file mode 100644 index 000000000..b203bc56a --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.benjamin/friend01.C @@ -0,0 +1,31 @@ +// { dg-do assemble } +//980610 bkoz +// example 1: buggy + +class foo { +public: + class bar; + int func(bar *); + class bar { + int st; + public: + bar(){st=12;} + ~bar(){} + friend int foo::func(bar *); + }; + foo(){} + ~foo(){} +}; + + +int foo::func(bar *obj) { + obj->st++; + return (obj->st); +} + +void test02() { + foo obj_f; + foo::bar obj_b; + + obj_f.func( &obj_b); +} diff --git a/gcc/testsuite/g++.old-deja/g++.benjamin/friend02.C b/gcc/testsuite/g++.old-deja/g++.benjamin/friend02.C new file mode 100644 index 000000000..f6ab601d0 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.benjamin/friend02.C @@ -0,0 +1,31 @@ +// { dg-do assemble } +//980610 bkoz +// example 2: ok + +class bar; +class foo { +public: + int func(bar *); + foo(){} + ~foo(){} +}; + +class bar { + int st; +public: + bar(){st=12;} + ~bar(){} + friend int foo::func(bar *); +}; + +int foo::func(bar *obj) { + obj->st++; + return (obj->st); +} + +void test02() { + foo obj_f; + bar obj_b; + + obj_f.func( &obj_b); +} diff --git a/gcc/testsuite/g++.old-deja/g++.benjamin/p12475.C b/gcc/testsuite/g++.old-deja/g++.benjamin/p12475.C new file mode 100644 index 000000000..d3e121e14 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.benjamin/p12475.C @@ -0,0 +1,14 @@ +// { dg-do assemble } +// prms-id: 12475 + +#include + +#if LONG_MAX == 2147483647 +#define TEST 2147483648 +#elif LONG_MAX == 9223372036854775807 +#define TEST 9223372036854775808 +#else +#error "Unsupported test -- add new constants." +#endif + +enum huh { start =-TEST, next }; // { dg-warning "" } diff --git a/gcc/testsuite/g++.old-deja/g++.benjamin/p13417.C b/gcc/testsuite/g++.old-deja/g++.benjamin/p13417.C new file mode 100644 index 000000000..132b13df2 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.benjamin/p13417.C @@ -0,0 +1,11 @@ +// { dg-do assemble } +// { dg-options "-Wno-deprecated" } +// prms-id: 13417 + +class Foo { +public: + explicit Foo (int){} +}; +Foo f(10); +Foo blat() return f(4){} // { dg-error "" } named return value + diff --git a/gcc/testsuite/g++.old-deja/g++.benjamin/p13721.C b/gcc/testsuite/g++.old-deja/g++.benjamin/p13721.C new file mode 100644 index 000000000..960c3e0dd --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.benjamin/p13721.C @@ -0,0 +1,21 @@ +// { dg-do assemble } +// prms-id: 13721 + +class A +{ + public : + int a; +}; +class B : public A +{ + public : + void cmp(int a, int b) {} + B(int a = 0) + { + cmp(A::a, a); //should not give warning + } +}; +int main(void) +{ + return(1); +} diff --git a/gcc/testsuite/g++.old-deja/g++.benjamin/scope01.C b/gcc/testsuite/g++.old-deja/g++.benjamin/scope01.C new file mode 100644 index 000000000..b67606ac1 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.benjamin/scope01.C @@ -0,0 +1,71 @@ +// { dg-do assemble } +// 980604 bkoz +// 3.4.5 Class member access p 4 +// nested and non-nested calls, no dtors + +struct L { + int ii; + void foo(int a) {++a;} + struct Linner { + int ii_inner; + void foo_inner(int b) {++b;} + }; +}; +class A : public L {}; +class B : public L {}; +class C : public A, public B {}; + + +void foo() { + // straight call + C x; + x.A::ii = 5; + x.A::foo(x.A::ii); + + // 5.1 Primary expressions + // p 8 + // a nested name specifier that names a class, + // optionally followed by the keyword template and then followd by + // the name of a member of either that class or one of its base + // classes is a qualified-id. (3.4.3.1 describes their lookup.) + + // 5.2.5 Class memember access + + // p 3 if E1 has the type 'pointer to class X' then + // E1->E2 == (*(E1)).E32 + // E1 == object-expression + // E2 == id-expression + // thus everything gets converted to the "." notation + + // p 2 + // the id-expression shall name a member of the class + // (object-expression) or of one of its base classes. + + // p4 if E2 is a nested type (of the object-expression), tye + // expression E1.E2 is ill formed. + + // try 1 nested call - ERROR +#if 0 + C x2; + x2.A::L::Linner::ii_inner = 6; //ERROR violates p2, does not name member of C + x2.A::L::Linner::foo_inner(x2.A::L::Linner::ii_inner); +#endif + + //try2: scoped method call -edg +acc +g++ +#if 1 + C::A::Linner x2; + x2.A::Linner::ii_inner = 6; + x2.A::Linner::foo_inner(x2.A::Linner::ii_inner); +#endif + + //try 3: non-scoped method call -edg +acc +g++ +#if 0 + C::A::L::Linner x3; + x3.ii_inner = 6; + x3.foo_inner(x3.ii_inner); +#endif +} + + + + diff --git a/gcc/testsuite/g++.old-deja/g++.benjamin/scope02.C b/gcc/testsuite/g++.old-deja/g++.benjamin/scope02.C new file mode 100644 index 000000000..1ff541b88 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.benjamin/scope02.C @@ -0,0 +1,208 @@ +// { dg-do assemble } +//980529 bkoz +//3.4.5 Class member access via pointer and non-pointer +// non-nested dtor calls + +int counter = 0; + +struct X { + int rank; + X(int init = 64) : rank(init) { } + ~X() { ++counter; } + typedef X classtype; +}; +typedef X globaltype; + +#if 0 +template +struct X_tem { + T rank; + X_tem(T init = T(64) ) : rank(init) { } + ~X_tem() { ++counter; } + typedef X_tem classtype_tem; +}; +typedef X_tem globaltype_tem; +#endif + + + + +int main(void) +{ + // 3.4.5 Class member access + // p 2 + // if the id-expression in a class member access is an + // unqualified-id, and the type of the object expression is of class + // type C (or pointer to class type C), the unqualified-id is looked + // up in the scope of class C. If the type of the object-expression + // is of pointer to scalar type, the unqualified-id is looked up in + // the context of the complete postfix-expression. + + // p 3 + // if the unqualitified id is ~type-name, and the type of the object + // expression is of a class type C (or pointer to class type C), the + // type-name is looked up in the context of the entire + // postfix-expression and in the scope of class C. The type-name + // shall refer to a class-name. If type-name is found in both + // contexts, the name shall refer to the same class type. If the + // type of the object expression is of scalar type, the type-name is + // looked up in the complete postfix-expression. + + typedef X localtype; + + // + // 1 non-templatized, pointer, unqualified + // + X x01 ; + X *px = &x01; + px->~X(); + + X x02 (66); + px = &x02; + px->~localtype(); + + X x03 (68); + px = &x03; + px->~classtype(); //-g++ //p3: unqual-id lookup in object and postfix-expr + + X x04 (70); + px = &x04; + px->~globaltype(); + + + // p 1 + // . . . the id-expression is first looked up in the class of the + // object-expression. If the identifier is not found, itis then + // looked up in the context of the entier postfix-expression and + // shall name a class or function template. If the lookup in the + // class of the object-expression finds a template, the name is also + // looked up in teh context of the entier postfix-expression and + // 1 if the name is not found, use the name from the object-expr + // 2 if the name found in postfix-expr != class template, use object-expr + // 3 if name found is class template, name must match object-expr or error + + // p 4 + + // if the id-expr in a class member acess is a qualified-id, the + // id-expression is looked up in both the context of the entire + // postfix-expr and in the scope of the class of the object-expr. If + // the name is found in both contexts, the id-expr shall refer to + // the same entity. + + + // + // 2 non-templatized, pointer, qualified + // + X x05 ; + px = &x05; + px->X::~X(); + + X x06 (66); + px = &x06; + px->X::~localtype(); + + X x07 (68); + px = &x07; + px->X::~classtype(); // -edg + + X x08 (70); + px = &x08; + px->X::~globaltype(); + + X x09 (66); + px = &x09; + px->localtype::~localtype(); + + X x10 (68); + px = &x10; + px->classtype::~classtype(); + + X x11 (70); + px = &x11; + px->globaltype::~globaltype(); + + X x12 (66); + px = &x12; + px->classtype::~localtype(); + + X x13 (68); + px = &x13; + px->globaltype::~localtype(); + + X x14 (70); + px = &x14; + px->localtype::~globaltype(); + + X x15 (70); + px = &x15; + px->classtype::~globaltype(); + + X x16 (70); + px = &x16; + px->localtype::~classtype(); //-edg + + X x17 (70); + px = &x17; + px->globaltype::~classtype(); //-edg + +#if 0 + // + // non-templatized, non-pointer + // + X xo5 ; + xo5.~X(); //unqualified + + localtype xo6 (66); + xo6.~localtype(); + + X xo7 (68); + xo7.~classtype(); + + X xo8 (70); + xo8.~globaltype(); + + + // + // templatized, pointer + // + X_tem xto1 ; + X_tem *pxt = &xto1; + pxt->~X_tem(); //unqualified + + typedef X_tem localtype_tem; + localtype_tem xto2 (66); + pxt = &xto2; + pxt->~localtype_tem(); + + //paragraph 2: unqualitifed id looked up in scope of post-fix expr if object + X_tem xto3 (68); + pxt = &xto3; + pxt->~classtype_tem(); + + X_tem xto4 (70); + pxt = &xto4; + pxt->~globaltype_tem(); + + // + // templatized, non-pointer + // + X_tem xto5 ; + xto5.~X_tem(); //unqualified + + localtype_tem xto6 (66); + xto6.~localtype_tem(); + + X_tem xto7 (68); + xto7.~classtype_tem(); + + X_tem xto8 (70); + xto8.~globaltype_tem(); +#endif + return 0; +} + + + + + + diff --git a/gcc/testsuite/g++.old-deja/g++.benjamin/tem01.C b/gcc/testsuite/g++.old-deja/g++.benjamin/tem01.C new file mode 100644 index 000000000..76c90c4a8 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.benjamin/tem01.C @@ -0,0 +1,136 @@ +// { dg-do assemble } +// prms-id: 13911 + +template +class ref_counter { +public: + ref_counter() : p_refcnt(new unsigned int(N)) {} + ref_counter(const ref_counter& x) : p_refcnt(x.p_refcnt) { + ++*p_refcnt; + } + ref_counter& operator=(const ref_counter& rhs) { + ++*rhs.p_refcnt; + decrement(); + p_refcnt = rhs.p_refcnt; + return *this; + } + ~ref_counter() {decrement();} + + bool unique() const {return *p_refcnt == N;} + +private: + unsigned int* p_refcnt; + void decrement() { + if (unique()) delete p_refcnt; + else --*p_refcnt; + } +}; + +template +class ref_pointer { +public: + + ref_pointer() : the_p(0) {} + ref_pointer(T* just_newed) : the_p(just_newed) {} + virtual ~ref_pointer() {if (unique()) delete the_p;} +protected: + ref_pointer(T* the_p_arg, ref_counter& ref_count_arg) + : the_p(the_p_arg), ref_count(ref_count_arg) {} + +public: + + ref_pointer& operator=(const ref_pointer&); + ref_pointer& operator=(T*); + operator const T*() const {return the_p;} + T* operator()() {return the_p;} + T* operator()() const {return the_p;} + T& operator*() const {return *the_p;} + friend bool operator==(const ref_pointer& lhs, + const ref_pointer& rhs) { + return lhs.the_p == rhs.the_p; + } + friend bool operator!=(const ref_pointer& lhs, + const ref_pointer& rhs) { + return lhs.the_p != rhs.the_p; + } + + + bool unique() const {return ref_count.unique();} + bool isNull() const {return the_p==0;} + +protected: + ref_counter& refCount() {return ref_count;} + +private: + + ref_counter ref_count; + T* the_p; +}; + +template +ref_pointer& ref_pointer::operator=(const ref_pointer& rhs) { + if (the_p != rhs.the_p) { + if (unique()) delete the_p; + the_p = rhs.the_p; + ref_count = rhs.ref_count; + } + return *this; +} + + +template +ref_pointer& ref_pointer::operator=(T* just_newed) { + if (unique()) delete the_p; + the_p = just_newed; + ref_count = ref_counter(); + return *this; +} + + + +template +class CountedObjPtr : public ref_pointer { +public: + CountedObjPtr() {} + CountedObjPtr(T* just_newed) : ref_pointer(just_newed) {} + CountedObjPtr(T* the_p_arg, ref_counter<1>& ref_count_arg) + : ref_pointer(the_p_arg, ref_count_arg) {} + CountedObjPtr& operator=(T* rhs) { + ref_pointer::operator=(rhs); + return *this; + } + CountedObjPtr& operator=(const CountedObjPtr& rhs) { + ref_pointer::operator=(rhs); + return *this; + } + T* operator->() const {return (*this)();} + +}; + + + + + +//instantiating type + +class TSObservable; + +class TSObserver { +public: + + enum TSType { NormalTS, UpYldCrvTS, DownYldCrvTS, ZeroVolTS }; + + virtual ~TSObserver() {} + + virtual void update(TSObservable* theChangedObservable) = 0; + virtual TSType key() const { return myKey; } + virtual TSType& key() { return myKey; } +protected: + TSObserver(TSType myKeyArg) : myKey(myKeyArg) {} + TSType myKey; +}; + + + +//now try to instantiate +template class CountedObjPtr; diff --git a/gcc/testsuite/g++.old-deja/g++.benjamin/tem02.C b/gcc/testsuite/g++.old-deja/g++.benjamin/tem02.C new file mode 100644 index 000000000..98be669e2 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.benjamin/tem02.C @@ -0,0 +1,54 @@ +// { dg-do assemble } +//980519 bad error from nathan +//$ egcs -fhonor-std -nostdinc -c redef.C +//redef.C:56: redefinition of default argument for `class _Traits' + +template struct char_traits; +template struct char_traits { }; +template<> struct char_traits; +template<> struct char_traits { }; + +template > class istreambuf_iterator; + + +template + class istreambuf_iterator +{ + public: + typedef _Traits traits_type; + class _Proxy; + public: + inline istreambuf_iterator() throw(); + inline istreambuf_iterator(const _Proxy& __p) throw(); +}; + + +template + class istreambuf_iterator<_CharT,_Traits>::_Proxy +{ + public: + _CharT operator*(); + + //bug -g++ w/ decl "redef", no decl no prob. + //ok -edg: no warnings + friend class istreambuf_iterator; // XXX OK? + + //bug -g++ w/ decl "redef", no decl no prob. + //ok -edg: no warnings + //friend class istreambuf_iterator<_CharT,_Traits>; + + //bug -g++ w/ decl "redef", no decl no prob. + //ok -edg: declaration of "_CharT" and "_Traits" hides template parameter + //template friend class istreambuf_iterator; + + //ok -g++ + //ok -edg + //friend class istreambuf_iterator<_CharT>; + +}; + + + +//explicit instantiation of a nested class +template class istreambuf_iterator >::_Proxy; + diff --git a/gcc/testsuite/g++.old-deja/g++.benjamin/tem03.C b/gcc/testsuite/g++.old-deja/g++.benjamin/tem03.C new file mode 100644 index 000000000..fb9830e68 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.benjamin/tem03.C @@ -0,0 +1,209 @@ +// { dg-do assemble } +// 980808-980824 bkoz +// template parameter redeclaration bugs + +// 14.1 Template parameters +// p 13 +// The scope of a template-parameter extens from its point of +// declartion until the end of its template. In particular, a +// template-parameter can be used in the declaration of subsequent +// template-parameters and their default arguments. + +// 14.6.1 Locally declared names +// p 4 +// A template-parameter shall not be redeclared within its scope +// (including nested scopes). A template-parameter shall not have the +// sname name as the template name. + + +// 01 +// declared friend template +template // { dg-error "" } .* +class Xone { +protected: + T4* next; + T4* prev; + T4 value; +public: + Xone(): next(0), prev(0), value(1999){} + Xone(T4 init): value(init) {} + + // these are ok: + // can also do template-decl and then can ditch the foward-declaration + // template friend bool isequal (Xone& lhs, Xone& rhs); + // this is not ok: + template friend bool isequal (Xone& lhs, Xone& rhs);// { dg-error "" } .* +}; + + +// 02 +// nested template class +template // { dg-error "" } .* +class Xtwo { +protected: + T6* next; + T6* prev; + T6 value; +public: + Xtwo(): next(0), prev(0), value(1999){} + Xtwo(T6 init): value(init) {} + + template class nested {// { dg-error "" } .* + T6 value; + public: + nested(): value( T6(0)) {} + }; +}; + + +// 03 +// member templates +template // { dg-error "" } .* +class Xthree { +protected: + T8* next; + T8* prev; + T8 value; +public: + Xthree(): next(0), prev(0), value(1999){} + Xthree(T8 init): value(init) {} + + template T8 comp_ge(T8 test) {// { dg-error "" } .* + T8 local_value; + if (local_value > value) + return local_value; + else + return value; + } +}; + + +// 04 +// local names (14.6.1 p 4) +template struct Xfour {// { dg-error "" } .* + int T10; // { dg-error "" } .* + void f(){ + char T10; // { dg-error "declaration of 'char T10'" } + } +}; + + +// 05 +// using different tempate-parms for out-of-line defs +template struct Xfive { + void f(); +}; + +template void Xfive::f() {// { dg-error "" } .* + int T13; // { dg-error "" } .* + int T12; //should be ok +} + + +// 06 +// multiple names at the same level +template class Xsix { // { dg-error "" } .* +private: +public: + void f(); +}; + + +// 07 +// multiple names, one in template parameter one in class-name +template class T12; // { dg-error "" } .* + + +// 08 +// with multiple template params, and second (third) one is redeclared +template class Xseven { // { dg-error "" } .* +private: + char T161; // { dg-error "" } .* +public: + template + friend bool fooy(U u); + + template // { dg-error "declaration of 'class T161'" } + friend bool foo(T161 u) + { + Xseven obj; + return (obj.inst == u.inst); + } + +}; + + +// 09 +// check for correct scoping of member templates +template +struct S1 +{ + template + void f(U u) + { + S1 s2u(u); + s2u.g(); + } + + template //ok + void f2(U u) + { + S1 s2u(u); + s2u.g(); + } + +}; + + +// 10 +// check for non-type parameters, should still be able to redeclare? +// local names (14.6.1 p 4) +template class Xten {// { dg-error "" } .* + float i; // { dg-error "" } .* +}; + + +// 11 +// declared friend template, non-type parameters +template // { dg-error "" } .* +class Xeleven { +public: + template friend bool isequal (Xeleven<5> lhs, Xeleven<5> rhs); // { dg-error "" } .* +}; + + + +// 12 +// nested template class, non-type parameters +template // { dg-error "" } .* +class Xtwelve { +public: + template class nested {// { dg-error "" } . + long value; + public: + nested(): value(0) {} + }; +}; + + +// 13 +// member templates, non-type parameters +template // { dg-error "" } .* +struct Xthirteen { + template long comp_ge(long test) {// { dg-error "" } . + long local_value; + if (local_value > value) // { dg-error "" } .* + return local_value; + else + return value; + } +}; + + + + + + + + + diff --git a/gcc/testsuite/g++.old-deja/g++.benjamin/tem04.C b/gcc/testsuite/g++.old-deja/g++.benjamin/tem04.C new file mode 100644 index 000000000..7dd7462c3 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.benjamin/tem04.C @@ -0,0 +1,182 @@ +// { dg-do assemble } +// 980827 bkoz +// template parameter redeclaration bugs, part two: +// template template params and expanded template non-type parms + +// 14.1 Template parameters +// p 13 +// The scope of a template-parameter extens from its point of +// declartion until the end of its template. In particular, a +// template-parameter can be used in the declaration of subsequent +// template-parameters and their default arguments. + +// 14.6.1 Locally declared names +// p 4 +// A template-parameter shall not be redeclared within its scope +// (including nested scopes). A template-parameter shall not have the +// same name as the template name. + +// 14 +// declared friend template (v3, template type parameters) +template // { dg-error "" } .* +class Xfourteen { +protected: + T4 value; +public: + Xfourteen(T4 init): value(init) {} + template