summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.old-deja/g++.benjamin
diff options
context:
space:
mode:
authorupstream source tree <ports@midipix.org>2015-03-15 20:14:05 -0400
committerupstream source tree <ports@midipix.org>2015-03-15 20:14:05 -0400
commit554fd8c5195424bdbcabf5de30fdc183aba391bd (patch)
tree976dc5ab7fddf506dadce60ae936f43f58787092 /gcc/testsuite/g++.old-deja/g++.benjamin
downloadcbb-gcc-4.6.4-554fd8c5195424bdbcabf5de30fdc183aba391bd.tar.bz2
cbb-gcc-4.6.4-554fd8c5195424bdbcabf5de30fdc183aba391bd.tar.xz
obtained gcc-4.6.4.tar.bz2 from upstream website;upstream
verified gcc-4.6.4.tar.bz2.sig; imported gcc-4.6.4 source tree from verified upstream tarball. downloading a git-generated archive based on the 'upstream' tag should provide you with a source tree that is binary identical to the one extracted from the above tarball. if you have obtained the source via the command 'git clone', however, do note that line-endings of files in your working directory might differ from line-endings of the respective files in the upstream repository.
Diffstat (limited to 'gcc/testsuite/g++.old-deja/g++.benjamin')
-rw-r--r--gcc/testsuite/g++.old-deja/g++.benjamin/13478.C30
-rw-r--r--gcc/testsuite/g++.old-deja/g++.benjamin/13523.C12
-rw-r--r--gcc/testsuite/g++.old-deja/g++.benjamin/13908.C21
-rw-r--r--gcc/testsuite/g++.old-deja/g++.benjamin/14139.C22
-rw-r--r--gcc/testsuite/g++.old-deja/g++.benjamin/14664-1.C15
-rw-r--r--gcc/testsuite/g++.old-deja/g++.benjamin/14664-2.C14
-rw-r--r--gcc/testsuite/g++.old-deja/g++.benjamin/14687.C53
-rw-r--r--gcc/testsuite/g++.old-deja/g++.benjamin/15054.C10
-rw-r--r--gcc/testsuite/g++.old-deja/g++.benjamin/15071.C12
-rw-r--r--gcc/testsuite/g++.old-deja/g++.benjamin/15309-1.C21
-rw-r--r--gcc/testsuite/g++.old-deja/g++.benjamin/15309-2.C10
-rw-r--r--gcc/testsuite/g++.old-deja/g++.benjamin/15756-1.C36
-rw-r--r--gcc/testsuite/g++.old-deja/g++.benjamin/15756-2.C50
-rw-r--r--gcc/testsuite/g++.old-deja/g++.benjamin/15799.C30
-rw-r--r--gcc/testsuite/g++.old-deja/g++.benjamin/15800-1.C18
-rw-r--r--gcc/testsuite/g++.old-deja/g++.benjamin/15800-2.C18
-rw-r--r--gcc/testsuite/g++.old-deja/g++.benjamin/15822.C28
-rw-r--r--gcc/testsuite/g++.old-deja/g++.benjamin/16077.C31
-rw-r--r--gcc/testsuite/g++.old-deja/g++.benjamin/16567.C44
-rw-r--r--gcc/testsuite/g++.old-deja/g++.benjamin/17922.C19
-rw-r--r--gcc/testsuite/g++.old-deja/g++.benjamin/17930.C6
-rw-r--r--gcc/testsuite/g++.old-deja/g++.benjamin/18208.C25
-rw-r--r--gcc/testsuite/g++.old-deja/g++.benjamin/bool01.C80
-rw-r--r--gcc/testsuite/g++.old-deja/g++.benjamin/bool02.C64
-rw-r--r--gcc/testsuite/g++.old-deja/g++.benjamin/friend01.C31
-rw-r--r--gcc/testsuite/g++.old-deja/g++.benjamin/friend02.C31
-rw-r--r--gcc/testsuite/g++.old-deja/g++.benjamin/p12475.C14
-rw-r--r--gcc/testsuite/g++.old-deja/g++.benjamin/p13417.C11
-rw-r--r--gcc/testsuite/g++.old-deja/g++.benjamin/p13721.C21
-rw-r--r--gcc/testsuite/g++.old-deja/g++.benjamin/scope01.C71
-rw-r--r--gcc/testsuite/g++.old-deja/g++.benjamin/scope02.C208
-rw-r--r--gcc/testsuite/g++.old-deja/g++.benjamin/tem01.C136
-rw-r--r--gcc/testsuite/g++.old-deja/g++.benjamin/tem02.C54
-rw-r--r--gcc/testsuite/g++.old-deja/g++.benjamin/tem03.C209
-rw-r--r--gcc/testsuite/g++.old-deja/g++.benjamin/tem04.C182
-rw-r--r--gcc/testsuite/g++.old-deja/g++.benjamin/tem05.C58
-rw-r--r--gcc/testsuite/g++.old-deja/g++.benjamin/tem06.C52
-rw-r--r--gcc/testsuite/g++.old-deja/g++.benjamin/tem07.C38
-rw-r--r--gcc/testsuite/g++.old-deja/g++.benjamin/typedef01.C46
-rw-r--r--gcc/testsuite/g++.old-deja/g++.benjamin/typedef03.C44
-rw-r--r--gcc/testsuite/g++.old-deja/g++.benjamin/typeid01.C72
-rw-r--r--gcc/testsuite/g++.old-deja/g++.benjamin/warn01.C98
-rw-r--r--gcc/testsuite/g++.old-deja/g++.benjamin/warn02.C54
-rw-r--r--gcc/testsuite/g++.old-deja/g++.benjamin/warn03.C10
-rw-r--r--gcc/testsuite/g++.old-deja/g++.benjamin/warn04.C9
45 files changed, 2118 insertions, 0 deletions
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<typename T> class latin_america;
+
+class peru
+{
+ friend class latin_america<int>; // Particular template class friend works
+ template<class T> 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 <typename T>
+ 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<int>;
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 <assert.h>
+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 <iostream>
+
+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 <limits.h>
+
+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 &) <near match>
+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 <assert.h>
+
+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<uint_32>(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 <assert.h>
+#include <limits.h>
+
+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 <assert.h>
+
+
+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 <limits.h>
+
+#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 <typename T>
+struct X_tem {
+ T rank;
+ X_tem(T init = T(64) ) : rank(init) { }
+ ~X_tem() { ++counter; }
+ typedef X_tem classtype_tem;
+};
+typedef X_tem<int> 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<int> xto1 ;
+ X_tem<int> *pxt = &xto1;
+ pxt->~X_tem(); //unqualified
+
+ typedef X_tem<int> 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<int> xto3 (68);
+ pxt = &xto3;
+ pxt->~classtype_tem();
+
+ X_tem<int> xto4 (70);
+ pxt = &xto4;
+ pxt->~globaltype_tem();
+
+ //
+ // templatized, non-pointer
+ //
+ X_tem<int> xto5 ;
+ xto5.~X_tem(); //unqualified
+
+ localtype_tem xto6 (66);
+ xto6.~localtype_tem();
+
+ X_tem<int> xto7 (68);
+ xto7.~classtype_tem();
+
+ X_tem<int> 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<unsigned int N>
+class ref_counter {
+public:
+ ref_counter() : p_refcnt(new unsigned int(N)) {}
+ ref_counter(const ref_counter<N>& x) : p_refcnt(x.p_refcnt) {
+ ++*p_refcnt;
+ }
+ ref_counter& operator=(const ref_counter<N>& 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 T, unsigned int N>
+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<N>& 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<T, N>& lhs,
+ const ref_pointer<T, N>& rhs) {
+ return lhs.the_p == rhs.the_p;
+ }
+ friend bool operator!=(const ref_pointer<T, N>& lhs,
+ const ref_pointer<T, N>& 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<N>& refCount() {return ref_count;}
+
+private:
+
+ ref_counter<N> ref_count;
+ T* the_p;
+};
+
+template<class T, unsigned int N>
+ref_pointer<T, N>& ref_pointer<T, N>::operator=(const ref_pointer<T, N>& 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<class T, unsigned int N>
+ref_pointer<T, N>& ref_pointer<T, N>::operator=(T* just_newed) {
+ if (unique()) delete the_p;
+ the_p = just_newed;
+ ref_count = ref_counter<N>();
+ return *this;
+}
+
+
+
+template<class T>
+class CountedObjPtr : public ref_pointer<T, 1> {
+public:
+ CountedObjPtr() {}
+ CountedObjPtr(T* just_newed) : ref_pointer<T, 1>(just_newed) {}
+ CountedObjPtr(T* the_p_arg, ref_counter<1>& ref_count_arg)
+ : ref_pointer<T, 1>(the_p_arg, ref_count_arg) {}
+ CountedObjPtr<T>& operator=(T* rhs) {
+ ref_pointer<T, 1>::operator=(rhs);
+ return *this;
+ }
+ CountedObjPtr<T>& operator=(const CountedObjPtr<T>& rhs) {
+ ref_pointer<T, 1>::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<TSObserver>;
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<class _CharT> struct char_traits;
+template<class _CharT> struct char_traits { };
+template<> struct char_traits<char>;
+template<> struct char_traits<char> { };
+
+template<class _CharT, class _Traits = char_traits<_CharT> > class istreambuf_iterator;
+
+
+template<class _CharT, class _Traits>
+ class istreambuf_iterator
+{
+ public:
+ typedef _Traits traits_type;
+ class _Proxy;
+ public:
+ inline istreambuf_iterator() throw();
+ inline istreambuf_iterator(const _Proxy& __p) throw();
+};
+
+
+template <class _CharT, class _Traits>
+ 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 <class _CharT, class _Traits> friend class istreambuf_iterator;
+
+ //ok -g++
+ //ok -edg
+ //friend class istreambuf_iterator<_CharT>;
+
+};
+
+
+
+//explicit instantiation of a nested class
+template class istreambuf_iterator<char, char_traits<char> >::_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 <class T4>// { 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 <class T5> friend bool isequal (Xone<T5>& lhs, Xone<T5>& rhs);
+ // this is not ok:
+ template <class T4> friend bool isequal (Xone<T4>& lhs, Xone<T4>& rhs);// { dg-error "" } .*
+};
+
+
+// 02
+// nested template class
+template <class T6>// { 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 T6> class nested {// { dg-error "" } .*
+ T6 value;
+ public:
+ nested(): value( T6(0)) {}
+ };
+};
+
+
+// 03
+// member templates
+template <class T8>// { 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 <class T8> 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 <class T10, int i> 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 <class T12, int i> struct Xfive {
+ void f();
+};
+
+template <class T13, int i> void Xfive<T13,i>::f() {// { dg-error "" } .*
+ int T13; // { dg-error "" } .*
+ int T12; //should be ok
+}
+
+
+// 06
+// multiple names at the same level
+template <class T14, class T14> class Xsix { // { dg-error "" } .*
+private:
+public:
+ void f();
+};
+
+
+// 07
+// multiple names, one in template parameter one in class-name
+template <class T12> class T12; // { dg-error "" } .*
+
+
+// 08
+// with multiple template params, and second (third) one is redeclared
+template <class T16, int i, class T161> class Xseven { // { dg-error "" } .*
+private:
+ char T161; // { dg-error "" } .*
+public:
+ template <class U>
+ friend bool fooy(U u);
+
+ template <class T161> // { dg-error "declaration of 'class T161'" }
+ friend bool foo(T161 u)
+ {
+ Xseven<T161, 5, int> obj;
+ return (obj.inst == u.inst);
+ }
+
+};
+
+
+// 09
+// check for correct scoping of member templates
+template <class T>
+struct S1
+{
+ template <class U>
+ void f(U u)
+ {
+ S1<U> s2u(u);
+ s2u.g();
+ }
+
+ template <class U> //ok
+ void f2(U u)
+ {
+ S1<U> 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 T18, int i> class Xten {// { dg-error "" } .*
+ float i; // { dg-error "" } .*
+};
+
+
+// 11
+// declared friend template, non-type parameters
+template <long l>// { dg-error "" } .*
+class Xeleven {
+public:
+ template <long l> friend bool isequal (Xeleven<5> lhs, Xeleven<5> rhs); // { dg-error "" } .*
+};
+
+
+
+// 12
+// nested template class, non-type parameters
+template <long l>// { dg-error "" } .*
+class Xtwelve {
+public:
+ template <long l> class nested {// { dg-error "" } .
+ long value;
+ public:
+ nested(): value(0) {}
+ };
+};
+
+
+// 13
+// member templates, non-type parameters
+template <long l>// { dg-error "" } .*
+struct Xthirteen {
+ template <long l> 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 <class T4>// { dg-error "" } .*
+class Xfourteen {
+protected:
+ T4 value;
+public:
+ Xfourteen(T4 init): value(init) {}
+ template <template <typename T4> class T5> // { dg-error "" } .*
+ friend bool isequal (Xfourteen<int>& lhs, Xfourteen<int>& rhs);
+};
+
+
+// 15
+// nested template class (v3, template type parameters)
+template <class T6>// { dg-error "" } .*
+class Xfifteen {
+protected:
+ T6 value;
+public:
+ Xfifteen(T6 init): value(init) {}
+
+ template <template <typename T6> class T7> class nested {// { dg-error "" } .*
+ int value;
+ public:
+ nested(): value( int(0)) {}
+ };
+};
+
+
+// 16
+// member templates (v3, template type parameters)
+template <class T8>// { dg-error "" } .*
+class Xsixteen {
+protected:
+ T8 value;
+public:
+ Xsixteen(T8 init): value(init) {}
+
+ template <template <typename T8> class T9> int comp_ge(int test) {// { dg-error "" } .*
+ int local_value;
+ if (local_value > value)
+ return local_value;
+ else
+ return value;
+ }
+};
+
+
+// 17
+// declared friend template (v4, template type parameters on the class)
+template <typename T9> class tem_base {
+public:
+ T9 value;
+};
+
+template <typename T10, template <typename T12> class C10>
+class Xseventeen {
+protected:
+ C10<T10> value;
+public:
+ Xseventeen(){}
+ template <typename T12> // ok??
+ friend bool isequal (Xseventeen<T10, tem_base>& lhs,
+ Xseventeen<T10, tem_base>& rhs);
+};
+
+//template class Xseventeen<int, tem_base>;
+
+
+// 18
+// more template template redecl tests
+template <typename T14, template <typename T15> class C12>// { dg-error "" } .*
+class Xeighteen {
+protected:
+ C12<T14> value;
+ int C12; // { dg-error "" } .*
+};
+
+
+// 19
+// more template template redecl tests
+template <typename T16, template <typename T17> class C14>// { dg-error "" } .*
+class Xnineteen{
+protected:
+ C14<T16> value;
+ template <class C14> class nested {// { dg-error "" } .*
+ T16 value;
+ public:
+ nested(): value( T16(0)) {}
+ };
+};
+
+
+// 20
+// local names (14.6.1 p 4) part two, variable names as template param
+template <class T17, int i> struct Xtwenty {
+ void f(){
+ T17 my_type; //ok
+ for (int j = 0; j < 5; ++j)
+ {
+ T17 my_type; //ok
+ ++my_type;
+ }
+ }
+};
+
+
+// 14.1 Template parameters
+// p 4
+// A non-type templat- parameter shall have one of the following
+// (optionally cv-qualified) types:
+// integral or enumeration type
+// pointer to object or pointer to function
+// referenct to object or referece to function
+// pointer to member
+
+// 21
+// non-type template parameters v1: enum
+enum my_enum {my_A = 45, my_B, my_C};
+
+template <my_enum T18> class Xtwentyone {// { dg-error "" } .*
+ float T18; // { dg-error "" } .*
+};
+
+
+// 22
+// non-type template parameters v1: pointer to object
+struct base {
+ int gcount;
+ int ret_gcount() {return gcount;}
+};
+
+template <class T20, base* b> class Xtwentytwo {// { dg-error "" } .*
+ float b; // { dg-error "" } .*
+};
+
+
+// 23
+// non-type template parameters v2: reference to object
+template <class T20, base& b2> class Xtwentythree {// { dg-error "" } .*
+ float b2; // { dg-error "" } .*
+};
+
+
+// 24
+// non-type template parameters v3: pointer to member
+template <class T20, int base::* b3> class Xtwentyfour {// { dg-error "" } .*
+ float b3; // { dg-error "" } .*
+};
+
+
+// 25
+// non-type template parms that use push_class_level
+template <class T22> void f1() {// { dg-error "" } .*
+ struct foo {
+ enum T22 { un, du, toi }; // { dg-error "" } .*
+ };
+}
+
+
+
+
+
diff --git a/gcc/testsuite/g++.old-deja/g++.benjamin/tem05.C b/gcc/testsuite/g++.old-deja/g++.benjamin/tem05.C
new file mode 100644
index 000000000..7b6b95538
--- /dev/null
+++ b/gcc/testsuite/g++.old-deja/g++.benjamin/tem05.C
@@ -0,0 +1,58 @@
+// { dg-do assemble }
+// 980924 bkoz
+// just a quick test for export, to make sure we are warning for it.
+// CHANGE ME when it's supported
+
+
+// 14 Templates
+//p 6
+// A namespace-scope declaration or definintion of a non-line function
+// template, a non-inline member function template, a non-inline
+// member function of a class template or a static data member of a
+// class template may be preceeded by the export keyword. If such a
+// template is defined in the same translation unit in which it is
+// declared as exported, the definition is considered to be
+// exported. The first declaration of the template containing the
+// export keyword must not follow the definition. (meaning that export
+// can't beredeclared as non-export??)
+
+// 1
+// template definition
+export template <class T> // { dg-warning "" }
+bool templ_one(T a) {
+ if (a > 0)
+ return true;
+ else
+ return false;
+}
+
+
+// 2
+// static data, mf, mf template
+template <class T>
+class X_one {
+ unsigned short id;
+ T type;
+public:
+ static const bool is_specialized ;
+
+ X_one(const unsigned short& us = 5): id(us), type(T(0)) {}
+ unsigned short ret_id ();
+ template <class T2> bool compare_ge(T2 test);
+};
+
+export template <class T> // { dg-warning "" }
+const bool X_one<T>::is_specialized = false;
+
+export template <class T> // { dg-warning "" }
+unsigned short X_one<T>::ret_id() {
+ return id;
+}
+
+export template <class T2> // { dg-warning "" }
+bool compare_ge(T2 test) {
+ if (test > type) // { dg-error "" } .*
+ return true;
+ return false;
+}
+
diff --git a/gcc/testsuite/g++.old-deja/g++.benjamin/tem06.C b/gcc/testsuite/g++.old-deja/g++.benjamin/tem06.C
new file mode 100644
index 000000000..3233e0e96
--- /dev/null
+++ b/gcc/testsuite/g++.old-deja/g++.benjamin/tem06.C
@@ -0,0 +1,52 @@
+// { dg-do run }
+// 980945 bkoz
+// test for correct operators at link time
+
+/*
+/tmp/cca211431.o: In function `void blah<foo<int> >(foo<int> const &)':
+/tmp/cca211431.o(.void gnu.linkonce.t.blah<foo<int> >(foo<int> const &)+0x1e): undefined reference to `void x<int>(int const &)'
+*/
+
+template<class T>
+class foo {
+public:
+ foo () {}
+ friend void x (const T &) { }
+};
+
+void x(const int &);
+
+template<class T>
+void blah (const T &) {
+ T y;
+ x (4);
+}
+
+int main () {
+ const foo<int> v;
+ blah (v);
+}
+
+/*
+fno-exceptions -fno-rtti
+
+1.98r1.o:
+00000000 W __t3foo1Zi
+00000000 W blah__H1Zt3foo1Zi_RCX01_v
+00000000 t gcc2_compiled.
+00000000 T main
+ U x__H1Zi_RCX01_v
+
+1.egcs.o:
+00000000 W __t3foo1Zi
+00000000 W blah__H1Zt3foo1Zi_RCX01_v
+00000000 t gcc2_compiled.
+00000000 T main
+00000000 W x__FRCi
+
+
+the reason this goes away at -O is because the U or W function is
+elided completely.
+
+*/
+
diff --git a/gcc/testsuite/g++.old-deja/g++.benjamin/tem07.C b/gcc/testsuite/g++.old-deja/g++.benjamin/tem07.C
new file mode 100644
index 000000000..2b304b464
--- /dev/null
+++ b/gcc/testsuite/g++.old-deja/g++.benjamin/tem07.C
@@ -0,0 +1,38 @@
+// { dg-do run }
+
+template <class T>
+class Foo
+{
+public:
+ Foo(const T&);
+ Foo(const T&, const T&);
+};
+
+template <class T>
+Foo<T>::Foo(const T& t0)
+{
+}
+
+template <class T>
+Foo<T>::Foo(const T& t0, const T& t1)
+{
+}
+
+template Foo<int>::Foo(const int& t0);
+
+
+int main (void) {
+ return 0;
+}
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/gcc/testsuite/g++.old-deja/g++.benjamin/typedef01.C b/gcc/testsuite/g++.old-deja/g++.benjamin/typedef01.C
new file mode 100644
index 000000000..79a965b16
--- /dev/null
+++ b/gcc/testsuite/g++.old-deja/g++.benjamin/typedef01.C
@@ -0,0 +1,46 @@
+// { dg-do assemble }
+//980205 bkoz
+
+//7.1.3 the typedef specifier
+
+
+//p1
+typedef int MILES, *KLICKSP;
+MILES distance;
+extern KLICKSP metricp;
+
+//p2--can redefine to same type
+typedef struct s { /* ... */ } s;
+typedef int I;
+typedef int I;
+typedef I I;
+
+//p3--cannot redefine to a different type in a given scope
+class complex2 { /* ... */ };// { dg-error "" } .*
+typedef int complex2;// { dg-error "" } .*
+typedef int complex3;// { dg-error "" } .*
+class complex3 { /* ... */ };// { dg-error "" } .*
+
+
+//p4
+/*
+4 A typedef-name that names a class is a class-name (_class.name_). If
+ a typedef-name is used
+ 1) following the class-key in an elaborated-type-specifier
+ 2) or in the class-head of a class declaration
+ 3) or is used as the identifier in the declarator for a
+ constructor or destructor declaration
+ the program is ill-formed. [Example:
+*/
+struct S {
+ S();
+ ~S();
+};
+
+typedef struct S T; // { dg-error "previous declaration" }
+
+S a = T(); // OK
+struct T * p; // { dg-error "" } using typedef after struct
+
+//case01
+typedef bool short;// { dg-error "" } .*
diff --git a/gcc/testsuite/g++.old-deja/g++.benjamin/typedef03.C b/gcc/testsuite/g++.old-deja/g++.benjamin/typedef03.C
new file mode 100644
index 000000000..f2138402a
--- /dev/null
+++ b/gcc/testsuite/g++.old-deja/g++.benjamin/typedef03.C
@@ -0,0 +1,44 @@
+// { dg-do assemble }
+//980526 bkoz
+// reduced testcase for 980511 brendan qt bug
+
+
+class QTextStream
+{
+public:
+ QTextStream();
+ virtual ~QTextStream();
+
+ enum {
+ skipws = 0x0001,
+ left = 0x0002,
+ right = 0x0004,
+ internal = 0x0008,
+ bin = 0x0010,
+ oct = 0x0020,
+ dec = 0x0040,
+ hex = 0x0080,
+ showbase = 0x0100,
+ showpoint = 0x0200,
+ uppercase = 0x0400,
+ showpos = 0x0800,
+ scientific= 0x1000,
+ fixed = 0x2000
+ };
+
+ static const int basefield;
+ static const int adjustfield;
+};
+
+typedef QTextStream QTS;
+const int QTS::basefield = (QTS::bin | QTS::dec | QTS::hex) ;
+const int QTS::adjustfield = QTS::left | QTS::right | QTS::internal;
+#if 0
+#define QTS QTextStream
+const int QTS::basefield = (QTS::bin | QTS::dec | QTS::hex) ;
+const int QTS::adjustfield = QTS::left | QTS::right | QTS::internal;
+#endif
+
+
+
+
diff --git a/gcc/testsuite/g++.old-deja/g++.benjamin/typeid01.C b/gcc/testsuite/g++.old-deja/g++.benjamin/typeid01.C
new file mode 100644
index 000000000..439e22ac3
--- /dev/null
+++ b/gcc/testsuite/g++.old-deja/g++.benjamin/typeid01.C
@@ -0,0 +1,72 @@
+// { dg-do run }
+// 980617 bkoz
+// typeid for local types
+// typeid bool vs int and enum vs int
+
+#include <typeinfo>
+#ifdef DEBUG_ASSERT
+#include <assert.h>
+#endif
+
+// 4: local class in non-main function
+
+void test1 (void) {
+ bool class_p = false;
+ class X2 {
+ private:
+ unsigned int counter;
+ public:
+ X2 (unsigned int i = 35): counter(i) {}
+ ~X2(){}
+ unsigned int ret_counter() {return counter;}
+ };
+ X2 obj_1;
+ class_p = typeid(X2) == typeid(obj_1);
+}
+
+int main ()
+{
+ // 1: simple
+#if 1
+ bool enum_p = false;
+ enum E { A, B, C };
+ enum_p = typeid(A) == typeid(E);
+#ifdef DEBUG_ASSERT
+ assert (enum_p);
+#endif
+#endif
+
+ // 2: complex
+#if 0
+ bool enum2_p = false;
+ bool int_p = false;
+ bool bool_p = false;
+ enum E2 { A2, B2};
+ enum2_p = typeid(A2) == typeid(E2);
+ int_p = typeid(int) == typeid(E2);
+ bool_p = typeid(bool) == typeid(E2);
+#ifdef DEBUG_ASSERT
+ assert (enum2_p);
+ assert (!int_p);
+ assert (!bool_p);
+#endif
+#endif
+
+ // 3: local class
+ bool class_p = false;
+ class X {
+ private:
+ unsigned int counter;
+ public:
+ X (unsigned int i = 35): counter(i) {}
+ ~X(){}
+ unsigned int ret_counter() {return counter;}
+ };
+ X obj_1;
+ class_p = typeid(X) == typeid(obj_1);
+
+ // 4: local class in function
+ test1();
+
+ return 0;
+}
diff --git a/gcc/testsuite/g++.old-deja/g++.benjamin/warn01.C b/gcc/testsuite/g++.old-deja/g++.benjamin/warn01.C
new file mode 100644
index 000000000..99b23967c
--- /dev/null
+++ b/gcc/testsuite/g++.old-deja/g++.benjamin/warn01.C
@@ -0,0 +1,98 @@
+// { dg-do assemble }
+// { dg-options "-Wall -Weffc++" }
+
+//1 g++/12952 un-named variables in a catch block
+//Wall or Wunused should not give warnings here
+template <class T>
+void f (void) {
+ try
+ {
+ }
+
+ catch( int)
+ {
+ }
+}
+
+//
+//2 g++/12923 __attribute__((__unused__)) not working for objects
+//Weffc++ or Wunused should not report the object as an error
+class C {
+ public:
+ C();
+};
+
+void f (void){
+ C x __attribute__ ((__unused__));
+ int y __attribute__ ((__unused__));
+}
+
+//
+//3 g++/12982 lock should not give error here, as above
+void setLock ();
+void clearLock ();
+
+template <class T>
+class test {
+public:
+ class lock
+ {
+ public:
+ lock () { setLock(); }
+ ~lock () { clearLock(); }
+ };
+
+ static void f (void)
+ {
+ lock local __attribute__ ((__unused__));
+ }
+
+};
+
+
+//
+//4 g++/12988 neither Mutex nor AutoMutex varibles should give warnings here
+//compile with -Weffc++ or -Wunused depending on post or pre 97r1
+class Mutex {
+private:
+ long counter;
+public:
+ virtual long retcntr() {return counter;};
+ Mutex(int i = 0): counter(i) {};
+ virtual ~Mutex() {};
+} __attribute__ ((__unused__));
+
+class AutoMutex: public Mutex{
+private:
+ long counter2;
+public:
+ long retcntr() {return counter2;};
+ AutoMutex(int i = 0): counter2(i) {};
+ virtual ~AutoMutex() {};
+} __attribute__ ((__unused__));
+
+
+template <class T>
+int foofunc(T x){
+ Mutex sm(2);
+ AutoMutex m(&sm);
+ return 0;
+}
+
+
+//5 sanity check to make sure other attributes cannot be used
+class Mutex2 {
+private:
+ long counter;
+public:
+ virtual long retcntr() {return counter;};
+ Mutex2(int i = 0): counter(i) {};
+ virtual ~Mutex2() {};
+} __attribute__ ((warn)); // { dg-warning "" }
+
+
+
+
+
+
+
diff --git a/gcc/testsuite/g++.old-deja/g++.benjamin/warn02.C b/gcc/testsuite/g++.old-deja/g++.benjamin/warn02.C
new file mode 100644
index 000000000..248e1ed9f
--- /dev/null
+++ b/gcc/testsuite/g++.old-deja/g++.benjamin/warn02.C
@@ -0,0 +1,54 @@
+// { dg-do assemble }
+// { dg-options "-Wredundant-decls" }
+// 980413 bkoz
+// from g++/15307, tests for -Wredundant-decls
+// for friend functions and functions
+
+
+extern int foo(const char *);
+
+class A
+{
+ friend int foo(const char *);
+ int a;
+};
+
+class B
+{
+ friend int foo(const char *);
+ int foo2() {return b;}
+ int b;
+};
+
+class C
+{
+ friend int foo(const char *);
+ friend int foo(const char *); // { dg-warning "" }
+ int foo2() {return b;}
+ int b;
+};
+
+class D
+{
+public:
+ int foo2() {return b;} // { dg-error "with" }
+ int foo2() {return b;} // { dg-error "overloaded" }
+ int b;
+};
+
+class E
+{
+public:
+ int foo2(); // { dg-error "with" }
+ int foo2(); // { dg-error "overloaded" }
+ int b;
+};
+
+extern int foo3(const char *); // { dg-warning "" }
+extern int foo3(const char *); // { dg-warning "" }
+
+
+
+
+
+
diff --git a/gcc/testsuite/g++.old-deja/g++.benjamin/warn03.C b/gcc/testsuite/g++.old-deja/g++.benjamin/warn03.C
new file mode 100644
index 000000000..46f0fb6e1
--- /dev/null
+++ b/gcc/testsuite/g++.old-deja/g++.benjamin/warn03.C
@@ -0,0 +1,10 @@
+// { dg-do assemble }
+// { dg-options "-Wredundant-decls" }
+// 980420 bkoz
+// from g++/15307, tests for -Wredundant-decls for decls
+
+//shouldn't crash
+extern unsigned char *foo5[];
+extern unsigned char *foo5[];
+
+
diff --git a/gcc/testsuite/g++.old-deja/g++.benjamin/warn04.C b/gcc/testsuite/g++.old-deja/g++.benjamin/warn04.C
new file mode 100644
index 000000000..8319e989a
--- /dev/null
+++ b/gcc/testsuite/g++.old-deja/g++.benjamin/warn04.C
@@ -0,0 +1,9 @@
+// { dg-do assemble }
+// { dg-options "-Wno-non-template-friend" }
+// 980903 bkoz
+// make sure this option works
+
+
+template<class T> class task {
+ friend void next_time(); //shouldn't give a warning
+};