Commit a5434cb7 by Benjamin Kosnik Committed by Benjamin Kosnik

15071.C (main): Update to conformant headers and constructs.






2001-04-06  Benjamin Kosnik  <bkoz@redhat.com>

	* g++.old-deja/g++.benjamin/15071.C (main): Update to conformant
	headers and constructs.
	* g++.old-deja/g++.robertl/eb79.C: Same.
	* g++.old-deja/g++.robertl/eb77.C (main): Same.
	* g++.old-deja/g++.robertl/eb73.C: Same.
	* g++.old-deja/g++.robertl/eb66.C (main): Same.
	* g++.old-deja/g++.robertl/eb55.C (t): Same.
	* g++.old-deja/g++.robertl/eb54.C (main): Same.
	* g++.old-deja/g++.robertl/eb46.C (main): Same.
	* g++.old-deja/g++.robertl/eb44.C: Same.
	* g++.old-deja/g++.robertl/eb41.C (main): Same.
	* g++.old-deja/g++.robertl/eb4.C (main): Same.
	* g++.old-deja/g++.robertl/eb39.C: Same.
	* g++.old-deja/g++.robertl/eb33.C (main): Same.
	* g++.old-deja/g++.robertl/eb31.C (main): Same.
	* g++.old-deja/g++.robertl/eb30.C: Same.
	* g++.old-deja/g++.robertl/eb3.C: Same.
	* g++.old-deja/g++.robertl/eb24.C (T>): Same.
	* g++.old-deja/g++.robertl/eb21.C: Same.
	* g++.old-deja/g++.robertl/eb15.C: Same.
	* g++.old-deja/g++.robertl/eb118.C: Same.
	* g++.old-deja/g++.robertl/eb115.C (main): Same.
	* g++.old-deja/g++.robertl/eb113.C (streambuf): Same.
	* g++.old-deja/g++.robertl/eb109.C: Same.
	* g++.old-deja/g++.other/sibcall1.C (main): Same.
	* g++.old-deja/g++.mike/rtti1.C: Same.
	* g++.old-deja/g++.mike/p658.C: Same.
	* g++.old-deja/g++.mike/net46.C: Same.
	* g++.old-deja/g++.mike/net34.C: Same.
	* g++.old-deja/g++.mike/memoize1.C: Same.
	* g++.old-deja/g++.mike/eh2.C: Same.
	* g++.old-deja/g++.law/weak.C: Same.
	* g++.old-deja/g++.law/visibility7.C: Same.
	* g++.old-deja/g++.law/visibility25.C: Same.
	* g++.old-deja/g++.law/visibility22.C: Same.
	* g++.old-deja/g++.law/visibility2.C: Same.
	* g++.old-deja/g++.law/visibility17.C: Same.
	* g++.old-deja/g++.law/visibility13.C: Same.
	* g++.old-deja/g++.law/visibility10.C: Same.
	* g++.old-deja/g++.law/visibility1.C: Same.
	* g++.old-deja/g++.law/virtual3.C (eval): Same.
	* g++.old-deja/g++.law/vbase1.C: Same.
	* g++.old-deja/g++.law/operators32.C: Same.
	* g++.old-deja/g++.law/nest3.C: Same.
	* g++.old-deja/g++.law/missed-error2.C (foo): Same.
	* g++.old-deja/g++.law/except5.C (main): Same.
	* g++.old-deja/g++.law/cvt7.C (run): Same.
	* g++.old-deja/g++.law/cvt2.C: Same.
	* g++.old-deja/g++.law/cvt16.C: Same.
	* g++.old-deja/g++.law/ctors6.C (bar): Same.
	* g++.old-deja/g++.law/ctors17.C (main): Same.
	* g++.old-deja/g++.law/ctors13.C: Same.
	* g++.old-deja/g++.law/ctors12.C (main): Same.
	* g++.old-deja/g++.law/ctors10.C: Same.
	* g++.old-deja/g++.law/code-gen5.C: Same.
	* g++.old-deja/g++.law/bad-error7.C: Same.
	* g++.old-deja/g++.law/arm9.C: Same.
	* g++.old-deja/g++.law/arm12.C: Same.
	* g++.old-deja/g++.law/arg8.C: Same.
	* g++.old-deja/g++.law/arg1.C: Same.
	* g++.old-deja/g++.jason/typeid1.C (struct foo): Same.
	* g++.old-deja/g++.jason/template31.C: Same.
	* g++.old-deja/g++.jason/template24.C (main): Same.
	* g++.old-deja/g++.jason/2371.C: Same.
	* g++.old-deja/g++.eh/new2.C: Same.
	* g++.old-deja/g++.eh/new1.C: Same.
	* g++.old-deja/g++.brendan/ptolemy2.C: Same.
	* g++.old-deja/g++.brendan/nest21.C (main): Same.
	* g++.old-deja/g++.brendan/err-msg3.C: Same.
	* g++.old-deja/g++.brendan/crash62.C: Same.
	* g++.old-deja/g++.brendan/crash52.C: Same.
	* g++.old-deja/g++.brendan/crash49.C (main): Same.
	* g++.old-deja/g++.brendan/crash38.C: Same.
	* g++.old-deja/g++.brendan/crash15.C (main): Same.
	* g++.old-deja/g++.brendan/copy9.C: Same.

From-SVN: r41167
parent 62fce11f
2001-04-06 Benjamin Kosnik <bkoz@redhat.com>
* g++.old-deja/g++.benjamin/15071.C (main): Update to conformant
headers and constructs.
* g++.old-deja/g++.robertl/eb79.C: Same.
* g++.old-deja/g++.robertl/eb77.C (main): Same.
* g++.old-deja/g++.robertl/eb73.C: Same.
* g++.old-deja/g++.robertl/eb66.C (main): Same.
* g++.old-deja/g++.robertl/eb55.C (t): Same.
* g++.old-deja/g++.robertl/eb54.C (main): Same.
* g++.old-deja/g++.robertl/eb46.C (main): Same.
* g++.old-deja/g++.robertl/eb44.C: Same.
* g++.old-deja/g++.robertl/eb41.C (main): Same.
* g++.old-deja/g++.robertl/eb4.C (main): Same.
* g++.old-deja/g++.robertl/eb39.C: Same.
* g++.old-deja/g++.robertl/eb33.C (main): Same.
* g++.old-deja/g++.robertl/eb31.C (main): Same.
* g++.old-deja/g++.robertl/eb30.C: Same.
* g++.old-deja/g++.robertl/eb3.C: Same.
* g++.old-deja/g++.robertl/eb24.C (T>): Same.
* g++.old-deja/g++.robertl/eb21.C: Same.
* g++.old-deja/g++.robertl/eb15.C: Same.
* g++.old-deja/g++.robertl/eb118.C: Same.
* g++.old-deja/g++.robertl/eb115.C (main): Same.
* g++.old-deja/g++.robertl/eb113.C (streambuf): Same.
* g++.old-deja/g++.robertl/eb109.C: Same.
* g++.old-deja/g++.other/sibcall1.C (main): Same.
* g++.old-deja/g++.mike/rtti1.C: Same.
* g++.old-deja/g++.mike/p658.C: Same.
* g++.old-deja/g++.mike/net46.C: Same.
* g++.old-deja/g++.mike/net34.C: Same.
* g++.old-deja/g++.mike/memoize1.C: Same.
* g++.old-deja/g++.mike/eh2.C: Same.
* g++.old-deja/g++.law/weak.C: Same.
* g++.old-deja/g++.law/visibility7.C: Same.
* g++.old-deja/g++.law/visibility25.C: Same.
* g++.old-deja/g++.law/visibility22.C: Same.
* g++.old-deja/g++.law/visibility2.C: Same.
* g++.old-deja/g++.law/visibility17.C: Same.
* g++.old-deja/g++.law/visibility13.C: Same.
* g++.old-deja/g++.law/visibility10.C: Same.
* g++.old-deja/g++.law/visibility1.C: Same.
* g++.old-deja/g++.law/virtual3.C (eval): Same.
* g++.old-deja/g++.law/vbase1.C: Same.
* g++.old-deja/g++.law/operators32.C: Same.
* g++.old-deja/g++.law/nest3.C: Same.
* g++.old-deja/g++.law/missed-error2.C (foo): Same.
* g++.old-deja/g++.law/except5.C (main): Same.
* g++.old-deja/g++.law/cvt7.C (run): Same.
* g++.old-deja/g++.law/cvt2.C: Same.
* g++.old-deja/g++.law/cvt16.C: Same.
* g++.old-deja/g++.law/ctors6.C (bar): Same.
* g++.old-deja/g++.law/ctors17.C (main): Same.
* g++.old-deja/g++.law/ctors13.C: Same.
* g++.old-deja/g++.law/ctors12.C (main): Same.
* g++.old-deja/g++.law/ctors10.C: Same.
* g++.old-deja/g++.law/code-gen5.C: Same.
* g++.old-deja/g++.law/bad-error7.C: Same.
* g++.old-deja/g++.law/arm9.C: Same.
* g++.old-deja/g++.law/arm12.C: Same.
* g++.old-deja/g++.law/arg8.C: Same.
* g++.old-deja/g++.law/arg1.C: Same.
* g++.old-deja/g++.jason/typeid1.C (struct foo): Same.
* g++.old-deja/g++.jason/template31.C: Same.
* g++.old-deja/g++.jason/template24.C (main): Same.
* g++.old-deja/g++.jason/2371.C: Same.
* g++.old-deja/g++.eh/new2.C: Same.
* g++.old-deja/g++.eh/new1.C: Same.
* g++.old-deja/g++.brendan/ptolemy2.C: Same.
* g++.old-deja/g++.brendan/nest21.C (main): Same.
* g++.old-deja/g++.brendan/err-msg3.C: Same.
* g++.old-deja/g++.brendan/crash62.C: Same.
* g++.old-deja/g++.brendan/crash52.C: Same.
* g++.old-deja/g++.brendan/crash49.C (main): Same.
* g++.old-deja/g++.brendan/crash38.C: Same.
* g++.old-deja/g++.brendan/crash15.C (main): Same.
* g++.old-deja/g++.brendan/copy9.C: Same.
Fri Apr 6 15:36:15 2001 J"orn Rennecke <amylaar@redhat.com> Fri Apr 6 15:36:15 2001 J"orn Rennecke <amylaar@redhat.com>
* gcc.c-torture/execute/20001203-2.c (main): * gcc.c-torture/execute/20001203-2.c (main):
......
...@@ -2,10 +2,10 @@ ...@@ -2,10 +2,10 @@
// g++/15071 // g++/15071
// gcc invocation fails to link in libstdc++ // gcc invocation fails to link in libstdc++
#include <iostream.h> #include <iostream>
int main() { int main() {
cout<<"hi"<<endl; std::cout << "hi" << std::endl;
return 0; return 0;
} }
// GROUPS passed copy-ctors // GROUPS passed copy-ctors
#include <iostream.h> #include <iostream>
// token types: from state parser // token types: from state parser
const int T_EOF = 257; const int T_EOF = 257;
...@@ -35,10 +35,11 @@ main () { ...@@ -35,10 +35,11 @@ main () {
ParseToken b(a); ParseToken b(a);
if (b.doubleval == 23.2) if (b.doubleval == 23.2)
cout << "PASS\n"; std::cout << "PASS\n";
else else
{ {
cout << "FAIL\n"; std::cout << "FAIL\n";
return 1; return 1;
} }
} }
// Build don't link: // Build don't link:
// GROUPS passed old-abort // GROUPS passed old-abort
#include <iostream.h> #include <iostream>
class A { class A {
public: public:
virtual ~A() {cout << "executed ~A()\n";}; virtual ~A() {std::cout << "executed ~A()\n";};
}; };
class B : public A { class B : public A {
public: public:
virtual ~B() {cout << "executed ~B()\n";}; virtual ~B() {std::cout << "executed ~B()\n";};
}; };
int int
main() { main() {
cout << "starting\n"; std::cout << "starting\n";
B b; B b;
b.~A();// ERROR - destructor b.~A();// ERROR - destructor
cout << "done\n"; std::cout << "done\n";
}; };
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
main.cc: Please report this to 'bug-g++@prep.ai.mit.edu' main.cc: Please report this to 'bug-g++@prep.ai.mit.edu'
*/ */
#include <stream.h> #include <iostream>
class INTEGER { class INTEGER {
int x; int x;
...@@ -16,7 +16,7 @@ public: ...@@ -16,7 +16,7 @@ public:
typedef int BASE; typedef int BASE;
INTEGER(int y) : x(y) {} INTEGER(int y) : x(y) {}
INTEGER() {} INTEGER() {}
void encode() { cout << "Integer encoder";} void encode() { std::cout << "Integer encoder";}
int operator=(int y) { x=y; return x; } int operator=(int y) { x=y; return x; }
operator int() {return x; } operator int() {return x; }
}; };
......
// Build don't link: // Build don't link:
// GROUPS passed old-abort // GROUPS passed old-abort
#include<iostream.h> #include<iostream>
const int keys = 10; const int keys = 10;
const int key[keys] = {6, key[1], 2, keys, 1, 7, 6, key[2], key[8]}; const int key[keys] = {6, key[1], 2, keys, 1, 7, 6, key[2], key[8]};
void main() void main()
{ // ERROR - return type for main { // ERROR - return type for main
for(int i = 0; i < keys;) cout << key[i++] << " "; for(int i = 0; i < keys;) std::cout << key[i++] << " ";
endl(cout); std::endl(std::cout);
} }
// Build don't link: // Build don't link:
// GROUPS passed old-abort // GROUPS passed old-abort
// Special g++ Options: -Wreturn-type // Special g++ Options: -Wreturn-type
#include <iostream.h> #include <iostream>
class A { class A {
public: public:
...@@ -9,6 +9,6 @@ public: ...@@ -9,6 +9,6 @@ public:
}; };
A &f(A &a) {// ERROR - new decl.* A &f(A &a) {// ERROR - new decl.*
cout << "Blah\n"; std::cout << "Blah\n";
} // ERROR - non-void function } // ERROR - non-void function
// Build don't link: // Build don't link:
// GROUPS passed old-abort // GROUPS passed old-abort
#include <iostream.h> #include <iostream>
void void
fubar(ostream* out, const char* string) fubar(std::ostream* out, const char* s)
{ {
(*out) << string << endl; (*out) << s << std::endl;
return; return;
} }
...@@ -14,8 +14,8 @@ ...@@ -14,8 +14,8 @@
{ {
// Declare a ref and a pointer to the same ostream. // Declare a ref and a pointer to the same ostream.
// //
ostream* out = &cerr; std::ostream* out = &std::cerr;
ostream& die = cerr; std::ostream& die = std::cerr;
// Valid call to fubar. // Valid call to fubar.
// //
......
// Build don't link: // Build don't link:
// GROUPS passed conversions // GROUPS passed conversions
#include <iostream.h> #include <iostream>
class Thing class Thing
{ {
...@@ -39,6 +39,6 @@ main (int argc, char** argv) ...@@ -39,6 +39,6 @@ main (int argc, char** argv)
Group g (Group::THIS_GROUP) ; Group g (Group::THIS_GROUP) ;
g += new Thing (Thing::GOOD_THING) ; g += new Thing (Thing::GOOD_THING) ;
cout << "Group type is " << (Group::GroupType) g << endl ; std::cout << "Group type is " << (Group::GroupType) g << std::endl ;
return 0 ; return 0 ;
} }
// Build don't link: // Build don't link:
// GROUPS passed error-messages // GROUPS passed error-messages
#include <fstream.h> #include <fstream>
#include <iomanip.h> #include <iomanip>
// This error should not appear: // This error should not appear:
// bug.C: In method `test::test(const class test &)': // bug.C: In method `test::test(const class test &)':
......
// GROUPS passed nested-classes // GROUPS passed nested-classes
#include <iostream.h> #include <iostream>
#include <stdio.h> #include <cstdio>
#include <string.h> #include <cstring>
static char output[1024]; static char output[1024];
...@@ -32,44 +32,44 @@ public: ...@@ -32,44 +32,44 @@ public:
BDDRetrace::Dump& BDDRetrace::Dump&
BDDRetrace::Dump1::operator<<(char c) BDDRetrace::Dump1::operator<<(char c)
{ char tempout[1024]; { char tempout[1024];
sprintf (tempout, "%s%s%c", output, "1-", c); std::sprintf(tempout, "%s%s%c", output, "1-", c);
strcpy (output, tempout); std::strcpy(output, tempout);
return *this; return *this;
} }
BDDRetrace::Dump& BDDRetrace::Dump&
BDDRetrace::Dump1::operator<<(int i) BDDRetrace::Dump1::operator<<(int i)
{ char tempout[1024]; { char tempout[1024];
sprintf (tempout, "%s%s%d", output, "1-", i); std::sprintf (tempout, "%s%s%d", output, "1-", i);
strcpy (output, tempout); std::strcpy (output, tempout);
return *this; } return *this; }
BDDRetrace::Dump& BDDRetrace::Dump&
BDDRetrace::Dump1::operator<<(double r) BDDRetrace::Dump1::operator<<(double r)
{ char tempout[1024]; { char tempout[1024];
sprintf (tempout, "%s%s%1.0f", output, "1-", r); std::sprintf (tempout, "%s%s%1.0f", output, "1-", r);
strcpy (output, tempout); std::strcpy (output, tempout);
return *this; } return *this; }
BDDRetrace::Dump& BDDRetrace::Dump&
Dump2::operator<<(char c) Dump2::operator<<(char c)
{ char tempout[1024]; { char tempout[1024];
sprintf (tempout, "%s%s%c", output, "2-", c); std::sprintf (tempout, "%s%s%c", output, "2-", c);
strcpy (output, tempout); std::strcpy (output, tempout);
return *this; } return *this; }
BDDRetrace::Dump& BDDRetrace::Dump&
Dump2::operator<<(int i) Dump2::operator<<(int i)
{ char tempout[1024]; { char tempout[1024];
sprintf (tempout, "%s%s%d", output, "2-", i); std::sprintf (tempout, "%s%s%d", output, "2-", i);
strcpy (output, tempout); std::strcpy (output, tempout);
return *this; } return *this; }
BDDRetrace::Dump& BDDRetrace::Dump&
Dump2::operator<<(double r) Dump2::operator<<(double r)
{ char tempout[1024]; { char tempout[1024];
sprintf (tempout, "%s%s%1.0f", output, "2-", r); std::sprintf (tempout, "%s%s%1.0f", output, "2-", r);
strcpy (output, tempout); std::strcpy (output, tempout);
return *this; } return *this; }
int main() int main()
...@@ -77,7 +77,7 @@ int main() ...@@ -77,7 +77,7 @@ int main()
BDDRetrace::Dump1 d1; BDDRetrace::Dump1 d1;
Dump2 d2; Dump2 d2;
sprintf (output, " "); std::sprintf (output, " ");
d1 << 'a'; d1 << 'a';
d1 << 1; d1 << 1;
...@@ -87,10 +87,10 @@ int main() ...@@ -87,10 +87,10 @@ int main()
d2 << 1; d2 << 1;
d2 << 1.0; d2 << 1.0;
if (strcmp (output, " 1-a1-11-12-a2-12-1") == 0) if (std::strcmp (output, " 1-a1-11-12-a2-12-1") == 0)
printf ("PASS\n"); std::printf ("PASS\n");
else else
{ printf ("FAIL\n"); return 1; } { std::printf ("FAIL\n"); return 1; }
return 0; return 0;
} }
// GROUPS passed ptolemy-bugs // GROUPS passed ptolemy-bugs
#include <iostream.h> #include <iostream>
class PTcl { class PTcl {
public: public:
...@@ -45,19 +45,19 @@ void printargs(char** argv) { ...@@ -45,19 +45,19 @@ void printargs(char** argv) {
} }
int PTcl::one(int, char** argv) { int PTcl::one(int, char** argv) {
cout << "FAIL\n"; std::cout << "FAIL\n";
printargs(argv); printargs(argv);
return 1; return 1;
} }
int PTcl::two(int, char** argv) { int PTcl::two(int, char** argv) {
cout << "PASS\n"; std::cout << "PASS\n";
printargs(argv); printargs(argv);
return 0; return 0;
} }
int PTcl::three(int, char** argv) { int PTcl::three(int, char** argv) {
cout << "FAIL\n"; std::cout << "FAIL\n";
printargs(argv); printargs(argv);
return 1; return 1;
} }
......
// Test that a throw in foo destroys the A, but does not free the memory. // Test that a throw in foo destroys the A, but does not free the memory.
#include <stddef.h> #include <cstddef>
#include <stdlib.h> #include <cstdlib>
#include <new.h> #include <new>
struct A { struct A {
A(); A();
...@@ -34,11 +34,15 @@ void foo (B*) { throw 1; } ...@@ -34,11 +34,15 @@ void foo (B*) { throw 1; }
void* operator new (size_t size) throw (std::bad_alloc) void* operator new (size_t size) throw (std::bad_alloc)
{ {
++newed; ++newed;
return (void *) malloc (size); return (void *) std::malloc (size);
} }
void operator delete (void *p) throw () void operator delete (void *p) throw ()
{ {
--newed; --newed;
free (p); std::free (p);
} }
// Test that a throw in B's constructor destroys the A and frees the memory. // Test that a throw in B's constructor destroys the A and frees the memory.
#include <stddef.h> #include <cstddef>
#include <stdlib.h> #include <cstdlib>
#include <new.h> #include <new>
struct A { struct A {
A(); A();
...@@ -35,7 +35,7 @@ void foo (B*) { } ...@@ -35,7 +35,7 @@ void foo (B*) { }
void* operator new (size_t size) throw (std::bad_alloc) void* operator new (size_t size) throw (std::bad_alloc)
{ {
++newed; ++newed;
return (void *) malloc (size); return (void *) std::malloc (size);
} }
void operator delete (void *p) throw () void operator delete (void *p) throw ()
...@@ -43,3 +43,4 @@ void operator delete (void *p) throw () ...@@ -43,3 +43,4 @@ void operator delete (void *p) throw ()
--newed; --newed;
free (p); free (p);
} }
...@@ -7,12 +7,12 @@ ...@@ -7,12 +7,12 @@
// Wendell Baker, Berkeley CAD Group, 1993 (wbaker@ic.Berkeley.EDU) // Wendell Baker, Berkeley CAD Group, 1993 (wbaker@ic.Berkeley.EDU)
// //
#pragma implementation "ListS.h" #pragma implementation "ListS.h"
#pragma implementation "SetLS.h" #pragma implementation "SetLS.h"
#include <stdlib.h> #include <cstdlib>
#include <iostream.h> #include <iostream>
using namespace std;
# 1 "../../templates/SetLS.h" 1 # 1 "../../templates/SetLS.h" 1
// -*- C++ -*- // -*- C++ -*-
......
// Bug: g++ doesn't find the conversion from ostream_withassign to ostream. // Bug: g++ doesn't find the conversion from ostream_withassign to ostream.
#include <iostream.h> #include <iostream>
template <class T> template <class T>
struct A { struct A {
...@@ -8,7 +8,7 @@ struct A { ...@@ -8,7 +8,7 @@ struct A {
}; };
template <class T> template <class T>
ostream & operator<< (ostream & os, A<T> & a) std::ostream & operator<< (std::ostream & os, A<T> & a)
{ {
os << a.t; os << a.t;
return os; return os;
...@@ -17,5 +17,6 @@ ostream & operator<< (ostream & os, A<T> & a) ...@@ -17,5 +17,6 @@ ostream & operator<< (ostream & os, A<T> & a)
int main () int main ()
{ {
A<int> a = { 1 }; A<int> a = { 1 };
cout << a << endl; std::cout << a << std::endl;
} }
// PRMS Id: 8569 // PRMS Id: 8569
#include <iostream.h> #include <iostream>
#include <vector> #include <vector>
using std::vector; using std::vector;
...@@ -33,10 +33,15 @@ private: ...@@ -33,10 +33,15 @@ private:
int main(int argc, char**argv) { int main(int argc, char**argv) {
IncludeIt foo; IncludeIt foo;
IncludeIt* bar; IncludeIt* bar;
exit(0); std::exit(0);
} }
template class std::__malloc_alloc_template<0>; template class std::__malloc_alloc_template<0>;
#ifndef __USE_MALLOC #ifndef __USE_MALLOC
template class std::__default_alloc_template<false, 0>; template class std::__default_alloc_template<false, 0>;
#endif #endif
#include <typeinfo> #include <typeinfo>
#include <iostream.h> #include <iostream>
struct foo { double f(int); }; struct foo { double f(int); };
int main() { int main() {
double f (int); double f (int);
const std::type_info &r = typeid (f); const std::type_info &r = typeid (f);
cout << typeid(f).name() << endl; std::cout << typeid(f).name() << std::endl;
cout << typeid(foo::f).name() << endl; std::cout << typeid(foo::f).name() << std::endl;
} }
...@@ -5,18 +5,18 @@ ...@@ -5,18 +5,18 @@
// From: kondo@akane.mech.ibaraki.ac.jp // From: kondo@akane.mech.ibaraki.ac.jp
// Date: Fri, 04 Sep 92 17:41:05 JST // Date: Fri, 04 Sep 92 17:41:05 JST
#include <iostream.h> #include <iostream>
// check the order of declarations // check the order of declarations
class A { class A {
public: public:
void f(double* p) { cout << "A(double*)\n"; } // ERROR - candidate void f(double* p) { std::cout << "A(double*)\n"; } // ERROR - candidate
void f(int* p) { cout << "A(int*)\n"; } // ERROR - candidate void f(int* p) { std::cout << "A(int*)\n"; } // ERROR - candidate
}; };
class B { class B {
public: public:
void f(int* p) { cout << "B(int*)\n"; } // ERROR - candidate void f(int* p) { std::cout << "B(int*)\n"; } // ERROR - candidate
void f(double* p) { cout << "B(double*)\n"; } // ERROR - candidate void f(double* p) { std::cout << "B(double*)\n"; } // ERROR - candidate
}; };
int main() int main()
...@@ -27,3 +27,4 @@ int main() ...@@ -27,3 +27,4 @@ int main()
a.f(0);// ERROR - .* a.f(0);// ERROR - .*
b.f(0);// ERROR - .* b.f(0);// ERROR - .*
} }
...@@ -6,22 +6,22 @@ ...@@ -6,22 +6,22 @@
// Date: Thu, 8 Jul 93 11:47:28 MDT // Date: Thu, 8 Jul 93 11:47:28 MDT
#include <iostream.h> #include <iostream>
#include <stdio.h> #include <cstdio>
// With this declaration the program will not link. // With this declaration the program will not link.
template <class Type> ostream & save(ostream & os, Type T); template <class Type> std::ostream & save(std::ostream & os, Type T);
template <class Type> ostream & template <class Type> std::ostream &
save(ostream & os, Type T) { save(std::ostream & os, Type T) {
return os << T; return os << T;
} // save } // save
int int
main() { main() {
int i = 10; int i = 10;
save((ostream &)cout, i) << endl; save((std::ostream &)std::cout, i) << std::endl;
short int s = 5; short int s = 5;
save((ostream &)cout, s) << endl; save((std::ostream &)std::cout, s) << std::endl;
printf ("PASS\n"); std::printf ("PASS\n");
} // main } // main
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
// Subject: Bad access control with private constructor and derivation // Subject: Bad access control with private constructor and derivation
// Date: Fri, 28 May 1993 12:39:57 -0400 (EDT) // Date: Fri, 28 May 1993 12:39:57 -0400 (EDT)
#include <iostream.h> #include <iostream>
class X class X
{ {
...@@ -24,17 +24,17 @@ public: ...@@ -24,17 +24,17 @@ public:
X::X() X::X()
{// ERROR - .* {// ERROR - .*
cout << "X::X()" << endl; std::cout << "X::X()" << std::endl;
} }
void X::f() void X::f()
{ {
cout << "X::f()" << endl; std::cout << "X::f()" << std::endl;
} }
Y::Y() Y::Y()
{// ERROR - within this {// ERROR - within this
cout << "Y::Y()" << endl; std::cout << "Y::Y()" << std::endl;
} }
...@@ -45,3 +45,5 @@ int main() ...@@ -45,3 +45,5 @@ int main()
} }
// Build don't link: // Build don't link:
// GROUPS passed ARM-compliance // GROUPS passed ARM-compliance
#include <iostream.h> #include <iostream>
enum f1 { enum f1 {
F1 F1
}; };
...@@ -13,13 +13,13 @@ class A { ...@@ -13,13 +13,13 @@ class A {
public: public:
void set (f1 f); void set (f1 f);
}; };
void A::set (f1 f) { cout << "called A f1\n";} void A::set (f1 f) { std::cout << "called A f1\n";}
class B : public A { class B : public A {
public: public:
void set (f2 f); void set (f2 f);
}; };
void B::set (f2 f) { cout << "called B\n";} // ERROR - candidate void B::set (f2 f) { std::cout << "called B\n";} // ERROR - candidate
int main() { int main() {
B b; B b;
...@@ -31,3 +31,8 @@ int main() { ...@@ -31,3 +31,8 @@ int main() {
// belong to different scopes. Thus B::set() should have // belong to different scopes. Thus B::set() should have
// hidden (completely) the A::set() function. // hidden (completely) the A::set() function.
} }
// Build don't link: // Build don't link:
// GROUPS passed bad-errors // GROUPS passed bad-errors
#include <iostream.h> #include <iostream>
class ParX class ParX
{ {
...@@ -11,7 +11,7 @@ class ParX ...@@ -11,7 +11,7 @@ class ParX
class X : public ParX class X : public ParX
{ {
public: public:
void fn2() { cout << "hi" << endl; } void fn2() { std::cout << "hi" << std::endl; }
}; };
int main() int main()
...@@ -22,3 +22,9 @@ int main() ...@@ -22,3 +22,9 @@ int main()
(pParX->*p)(); (pParX->*p)();
} }
...@@ -5,12 +5,12 @@ ...@@ -5,12 +5,12 @@
// Subject: An error! // Subject: An error!
// Message-ID: <9311160259.AA03353@pi14.arc.umn.edu> // Message-ID: <9311160259.AA03353@pi14.arc.umn.edu>
#include <stdlib.h> #include <cstdlib>
#include <stdio.h> #include <cstdio>
#include <assert.h> #include <cassert>
#include <fstream.h> #include <fstream>
#include <iostream.h> #include <iostream>
#include <math.h> #include <cmath>
#define ANSI_C #define ANSI_C
...@@ -79,7 +79,7 @@ class Vector ...@@ -79,7 +79,7 @@ class Vector
double assign( int, double ); double assign( int, double );
friend ostream& operator<<( ostream&, const Vector& m ); friend std::ostream& operator<<(std::ostream&, const Vector& m );
private: private:
...@@ -162,10 +162,10 @@ assign( int rownum, double d ) ...@@ -162,10 +162,10 @@ assign( int rownum, double d )
assert(r); assert(r);
if( rownum > row() || rownum <= 0 ) { if( rownum > row() || rownum <= 0 ) {
cerr << "Warning: trying to assign out of bounds" << endl; std::cerr << "Warning: trying to assign out of bounds" << std::endl;
cerr << "row " << rownum << endl; std::cerr << "row " << rownum << std::endl;
cerr << "Vector size " << row() << endl; std::cerr << "Vector size " << row() << std::endl;
abort(); std::abort();
} }
if( r->count == 1 ) { if( r->count == 1 ) {
...@@ -232,8 +232,9 @@ VecElem( Vector &vec, int r ) ...@@ -232,8 +232,9 @@ VecElem( Vector &vec, int r )
: v(vec), row(r) : v(vec), row(r)
{ {
if( r < 1 || r > vec.row() ) { if( r < 1 || r > vec.row() ) {
cerr << "Trying to access vector element out of bounds" << endl; std::cerr << "Trying to access vector element out of bounds";
abort(); std::cerr << std::endl;
std::abort();
} }
} }
...@@ -268,9 +269,9 @@ int main() ...@@ -268,9 +269,9 @@ int main()
int i, j; int i, j;
if (makeforms (cen,a,b) != 10) if (makeforms (cen,a,b) != 10)
{ printf ("FAIL\n"); return 1; } { std::printf ("FAIL\n"); return 1; }
else else
printf ("PASS\n"); std::printf ("PASS\n");
} }
...@@ -281,3 +282,5 @@ makeforms( Vector cen, Vector **a, Vector **b) ...@@ -281,3 +282,5 @@ makeforms( Vector cen, Vector **a, Vector **b)
return 10; return 10;
} }
...@@ -6,14 +6,14 @@ ...@@ -6,14 +6,14 @@
// Subject: bug019.cc // Subject: bug019.cc
// Date: Fri, 5 Feb 93 15:51:42 -0800 // Date: Fri, 5 Feb 93 15:51:42 -0800
#include <iostream.h> #include <iostream>
class Class class Class
{ {
class Err : public ostream class Err : public std::ostream
{ {
public: public:
Err(void) : ostream(NULL) { } Err(void) : std::ostream(NULL) { }
~Err(void) { } ~Err(void) { }
}; };
public: public:
......
// GROUPS passed constructors // GROUPS passed constructors
#include <stdio.h> #include <cstdio>
#include <stdlib.h> #include <cstdlib>
#include <iostream.h> #include <iostream>
#define MAGIC 7654 #define MAGIC 7654
...@@ -14,9 +14,9 @@ public: ...@@ -14,9 +14,9 @@ public:
complex() { re=im=0; magic=MAGIC; } complex() { re=im=0; magic=MAGIC; }
complex(double d) { re=d; im=0; magic=MAGIC; } complex(double d) { re=d; im=0; magic=MAGIC; }
complex(double d, double d2) {re=d; im=d2; magic=MAGIC; } complex(double d, double d2) {re=d; im=d2; magic=MAGIC; }
~complex() {if(magic!=MAGIC) {printf("FAIL\n");exit(1);}} ~complex() {if(magic!=MAGIC) {std::printf("FAIL\n"); std::exit(1);}}
friend ostream& operator << (ostream& o, const complex& c) friend std::ostream& operator << (std::ostream& o, const complex& c)
{ return o << "(" << c.re << "," << c.im << ")"; } { return o << "(" << c.re << "," << c.im << ")"; }
}; };
int complex::count=0; int complex::count=0;
...@@ -27,7 +27,7 @@ int main() ...@@ -27,7 +27,7 @@ int main()
int i; // page 289 int i; // page 289
for(i=0; i<6; i++) ; for(i=0; i<6; i++) ;
printf ("PASS\n"); std::printf ("PASS\n");
return 0; return 0;
} }
// Build don't link: // Build don't link:
// GROUPS passed constructors // GROUPS passed constructors
#include <iostream.h> #include <iostream>
class A { class A {
A() {} // private constructor// ERROR - .* A() {} // private constructor// ERROR - .*
...@@ -9,8 +9,10 @@ class A { ...@@ -9,8 +9,10 @@ class A {
int main() { int main() {
A* a = new A();// ERROR - .* A* a = new A();// ERROR - .*
if (a) { if (a) {
cout << "a != NULL\n"; std::cout << "a != NULL\n";
} else { } else {
cout << "a == NULL\n"; std::cout << "a == NULL\n";
} }
} }
...@@ -7,9 +7,9 @@ ...@@ -7,9 +7,9 @@
// Date: Tue, 15 Jun 1993 18:34:14 +0200 (MET DST) // Date: Tue, 15 Jun 1993 18:34:14 +0200 (MET DST)
#include <fstream.h> #include <fstream>
class X : public ifstream { // ERROR - candidate class X : public std::ifstream { // ERROR - candidate
public: public:
X(int a, char *b) {} // ERROR - candidate X(int a, char *b) {} // ERROR - candidate
}; };
......
// Build don't link: // Build don't link:
// GROUPS passed constructors // GROUPS passed constructors
#include <complex.h> #include <complex>
double foo(double_complex *a) double foo(std::complex<double> *a)
{ {
return 0.0; return 0.0;
} }
...@@ -10,6 +10,6 @@ double foo(double_complex *a) ...@@ -10,6 +10,6 @@ double foo(double_complex *a)
double bar(void) double bar(void)
{ {
double_complex v[10]; std::complex<double> v[10];
return foo(v); return foo(v);
} }
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
// Subject: g++ bug // Subject: g++ bug
// Date: Mon, 12 Apr 93 10:47:01 MDT // Date: Mon, 12 Apr 93 10:47:01 MDT
#include <iostream.h> #include <iostream>
class B { class B {
}; };
...@@ -22,8 +22,9 @@ public: ...@@ -22,8 +22,9 @@ public:
main() { main() {
A a(37); A a(37);
//cout << a << endl; //cout << a << endl;
cout << (short)a << endl; std::cout << (short)a << std::endl;
return 0; return 0;
} // main } // main
// GROUPS passed conversions // GROUPS passed conversions
#include <stdio.h> #include <cstdio>
#include <stdlib.h> #include <cstdlib>
#include <string.h> #include <cstring>
#include <iostream.h> #include <iostream>
#include <fstream.h> #include <fstream>
class cvec { class cvec {
public: public:
...@@ -25,18 +25,17 @@ void ...@@ -25,18 +25,17 @@ void
A(const char* s) A(const char* s)
{ {
// s still ok here // s still ok here
ifstream inf(s); std::ifstream inf(s);
if (strncmp ("aaa", s, 3)) if (std::strncmp ("aaa", s, 3))
{ {
printf ("FAIL\n"); std::printf ("FAIL\n");
exit (1); std::exit (1);
} }
else else
printf ("PASS\n"); std::printf ("PASS\n");
} }
int main() int main()
{ {
A(B("aaa")); A(B("aaa"));
} }
...@@ -5,8 +5,7 @@ ...@@ -5,8 +5,7 @@
// Message-Id: <9208250205.AA26351@icsib43.ICSI.Berkeley.EDU> // Message-Id: <9208250205.AA26351@icsib43.ICSI.Berkeley.EDU>
// Subject: implicit int. convs. from member refs. in switch expressions // Subject: implicit int. convs. from member refs. in switch expressions
#include <stream.h> #include <cstdio>
#include <stdio.h>
class A class A
{ {
...@@ -58,10 +57,10 @@ int main() ...@@ -58,10 +57,10 @@ int main()
switch (ar2) switch (ar2)
{ {
case 1: case 1:
printf ("PASS\n"); std::printf ("PASS\n");
break; break;
default: default:
{ printf ("FAIL\n"); return 1; } { std::printf ("FAIL\n"); return 1; }
} }
B b(a); B b(a);
...@@ -72,3 +71,10 @@ int main() ...@@ -72,3 +71,10 @@ int main()
return 0; return 0;
} }
...@@ -7,7 +7,8 @@ ...@@ -7,7 +7,8 @@
// Subject: exception's bug? // Subject: exception's bug?
// Date: Wed, 10 Nov 1993 11:07:12 -0500 // Date: Wed, 10 Nov 1993 11:07:12 -0500
#include <stream.h> #include <iostream>
class X { class X {
int *a; int *a;
int sz; int sz;
...@@ -33,7 +34,7 @@ main() ...@@ -33,7 +34,7 @@ main()
for (int i = 0; i < 12; i++) for (int i = 0; i < 12; i++)
c[i] = 1; c[i] = 1;
} catch (X::range) { } catch (X::range) {
cerr << "invalid range\n"; std::cerr << "invalid range\n";
} }
return 0; return 0;
} }
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
// Subject: More on [g++ 2.1 : overloaded function selection incorrect] // Subject: More on [g++ 2.1 : overloaded function selection incorrect]
// Message-ID: <9205212240.AA17934@ndc.com> // Message-ID: <9205212240.AA17934@ndc.com>
#include <iostream.h> #include <iostream>
inline int max(int a, int b) {return a > b ? a : b;}; // ERROR - candidate inline int max(int a, int b) {return a > b ? a : b;}; // ERROR - candidate
inline double max(double a, double b) {return a > b ? a : b;}; // ERROR - candidate inline double max(double a, double b) {return a > b ? a : b;}; // ERROR - candidate
...@@ -21,8 +21,8 @@ int main() { ...@@ -21,8 +21,8 @@ int main() {
// about the declaration above // about the declaration above
static void foo(int i, int j, double x, double y) { static void foo(int i, int j, double x, double y) {
cout << "Max(int): " << max(i,j) << " Max(double): " << std::cout << "Max(int): " << max(i,j) << " Max(double): " <<
max(x,y) << '\n'; max(x,y) << '\n';
cout << "Max(int, double): " << max(i, y) << '\n';// ERROR - std::cout << "Max(int, double): " << max(i, y) << '\n';// ERROR -
} }
// Build don't link: // Build don't link:
// GROUPS passed nest // GROUPS passed nest
#include <iostream.h> #include <iostream>
struct inner { struct inner {
static void f() { cout << "inner::f()\n";} static void f() { std::cout << "inner::f()\n";}
}; };
struct outer { struct outer {
struct inner { struct inner {
static void f() { cout << "outer::inner::f()\n";} static void f() { std::cout << "outer::inner::f()\n";}
}; };
static void f() { static void f() {
...@@ -20,6 +20,6 @@ struct outer { ...@@ -20,6 +20,6 @@ struct outer {
int main() { int main() {
outer::f(); outer::f();
cout << endl; std::cout << std::endl;
return 0; return 0;
} }
// Build don't link: // Build don't link:
// GROUPS passed operators // GROUPS passed operators
#include <iostream.h> #include <iostream>
// //
// frees space allocated for N-D array // frees space allocated for N-D array
...@@ -43,9 +43,9 @@ long d1 = 3, d2 = 4; ...@@ -43,9 +43,9 @@ long d1 = 3, d2 = 4;
class foo class foo
{ {
public: public:
foo() {cout << "foo created" << endl; } foo() {std::cout << "foo created" << std::endl; }
~foo() {cout << "foo deleted" << endl; } ~foo() {std::cout << "foo deleted" << std::endl; }
}; };
foo **f2; foo **f2;
......
...@@ -7,11 +7,11 @@ ...@@ -7,11 +7,11 @@
// Message-ID: <317f1j$o9c@agate.berkeley.edu> // Message-ID: <317f1j$o9c@agate.berkeley.edu>
#include <iostream.h> #include <iostream>
class a { class a {
protected: protected:
virtual void foo() { cout << "Class A\n";} virtual void foo() { std::cout << "Class A\n";}
}; };
class b : public virtual a {}; class b : public virtual a {};
...@@ -26,3 +26,4 @@ int main() { ...@@ -26,3 +26,4 @@ int main() {
test.bar(); test.bar();
} }
...@@ -5,12 +5,12 @@ ...@@ -5,12 +5,12 @@
// Date: 4 Nov 1993 22:57:36 -0500 // Date: 4 Nov 1993 22:57:36 -0500
// Message-ID: <9311041820.AA05942@ramjet.multinet.DE> // Message-ID: <9311041820.AA05942@ramjet.multinet.DE>
#include <iostream.h> #include <iostream>
#include <strstream.h> #include <sstream>
using namespace std; using namespace std;
class BugStream : public ostrstream { class BugStream : public ostringstream {
public: public:
BugStream() {} BugStream() {}
BugStream& eval(); BugStream& eval();
...@@ -26,12 +26,12 @@ BugStream& BugStream::eval() ...@@ -26,12 +26,12 @@ BugStream& BugStream::eval()
*this << ends; *this << ends;
// eval the command and set the status // eval the command and set the status
char* s = str(); const char* s = str().data();
cerr << s << endl; cerr << s << endl;
// reset the stream for the next command // reset the stream for the next command
clear(ios::goodbit); clear(ios::goodbit);
rdbuf()->freeze(0); // rdbuf()->freeze(0);
seekp(0); seekp(0);
return *this; return *this;
......
// Build don't link: // Build don't link:
// GROUPS passed visibility // GROUPS passed visibility
#include <iostream.h> #include <iostream>
...@@ -8,17 +8,17 @@ class base { ...@@ -8,17 +8,17 @@ class base {
//========== //==========
void base_priv(char * n) void base_priv(char * n)
{ cout << "base_priv called from: " << n << "\n"; }; { std::cout << "base_priv called from: " << n << "\n"; };
protected: protected:
void base_prot(char * n) void base_prot(char * n)
{ cout << "base_prot called from: " << n << "\n"; }; { std::cout << "base_prot called from: " << n << "\n"; };
public: public:
void base_publ(char * n) void base_publ(char * n)
{ cout << "base_publ called from: " << n << "\n"; }; { std::cout << "base_publ called from: " << n << "\n"; };
void test(char * n) { base_publ(n); base_prot(n); base_priv(n); } void test(char * n) { base_publ(n); base_prot(n); base_priv(n); }
...@@ -57,12 +57,12 @@ int main(int argc, char *argv[]) ...@@ -57,12 +57,12 @@ int main(int argc, char *argv[])
base b; base b;
b.base_publ("base class object"); b.base_publ("base class object");
b.test("member of base class object"); b.test("member of base class object");
cout << "\n"; std::cout << "\n";
derived pd; derived pd;
pd.test("member of derived class object"); pd.test("member of derived class object");
derived_friend(); derived_friend();
cout << "\n"; std::cout << "\n";
} /* main */ } /* main */
// Build don't link: // Build don't link:
// GROUPS passed visibility // GROUPS passed visibility
#include <iostream.h> #include <iostream>
class base { class base {
public: public:
void f1 () { cout << "f1" << endl; }; void f1 () { std::cout << "f1" << std::endl; };
void f2 () { cout << "f2" << endl; }; void f2 () { std::cout << "f2" << std::endl; };
}; };
class deriv : public base { class deriv : public base {
...@@ -19,3 +19,4 @@ int main () ...@@ -19,3 +19,4 @@ int main ()
d.f2(); d.f2();
} }
...@@ -6,11 +6,13 @@ ...@@ -6,11 +6,13 @@
// Subject: class, template and their scoping problem // Subject: class, template and their scoping problem
// Message-ID: <9307130521.AA18312@oahu.cs.ucla.edu> // Message-ID: <9307130521.AA18312@oahu.cs.ucla.edu>
#include <iostream.h> #include <iostream>
#include <assert.h> #include <cassert>
// --------------- Array.h && Array.cc ------------------ // --------------- Array.h && Array.cc ------------------
using namespace std;
const int ArraySize = 12; const int ArraySize = 12;
template <class Type> template <class Type>
......
...@@ -5,8 +5,8 @@ ...@@ -5,8 +5,8 @@
// Date: Thu, 05 Aug 1993 17:23:20 -0700 // Date: Thu, 05 Aug 1993 17:23:20 -0700
// Subject: Access to private constructor. // Subject: Access to private constructor.
// Message-ID: <9308060023.AA10283@neptune.caere.com> // Message-ID: <9308060023.AA10283@neptune.caere.com>
#include <iostream.h> #include <iostream>
#include <string.h> #include <cstring>
class Base class Base
{ {
...@@ -33,13 +33,13 @@ private: ...@@ -33,13 +33,13 @@ private:
Base::Base() Base::Base()
{ // ERROR - private { // ERROR - private
name_ = strcpy(new char[strlen(" ") + 1], " "); name_ = std::strcpy(new char[std::strlen(" ") + 1], " ");
} }
Base::Base(char* str) Base::Base(char* str)
{ // ERROR - private { // ERROR - private
if(str != NULL) if(str != NULL)
name_ = strcpy(new char[strlen(str) + 1], str); name_ = std::strcpy(new char[std::strlen(str) + 1], str);
} }
Derived::Derived(int n, char* str) : Base(str) Derived::Derived(int n, char* str) : Base(str)
...@@ -59,6 +59,8 @@ int main() ...@@ -59,6 +59,8 @@ int main()
// Derived* d = new Derived(10, "test"); // Derived* d = new Derived(10, "test");
Derived* d = new Derived(10); Derived* d = new Derived(10);
cerr << d->getNum() << "\t" << d->getName() << endl; std::cerr << d->getNum() << "\t" << d->getName() << std::endl;
} }
// Build don't link: // Build don't link:
// GROUPS passed visibility // GROUPS passed visibility
#include <iostream.h> #include <iostream>
...@@ -8,17 +8,17 @@ class base { ...@@ -8,17 +8,17 @@ class base {
//========== //==========
void base_priv(char * n) void base_priv(char * n)
{ cout << "base_priv called from: " << n << "\n"; }; { std::cout << "base_priv called from: " << n << "\n"; };
protected: protected:
void base_prot(char * n) void base_prot(char * n)
{ cout << "base_prot called from: " << n << "\n"; }; { std::cout << "base_prot called from: " << n << "\n"; };
public: public:
void base_publ(char * n) void base_publ(char * n)
{ cout << "base_publ called from: " << n << "\n"; }; { std::cout << "base_publ called from: " << n << "\n"; };
void test(char * n) { base_publ(n); base_prot(n); base_priv(n); } void test(char * n) { base_publ(n); base_prot(n); base_priv(n); }
...@@ -57,12 +57,12 @@ int main(int argc, char *argv[]) ...@@ -57,12 +57,12 @@ int main(int argc, char *argv[])
base b; base b;
b.base_publ("base class object"); b.base_publ("base class object");
b.test("member of base class object"); b.test("member of base class object");
cout << "\n"; std::cout << "\n";
derived pd; derived pd;
pd.test("member of derived class object"); pd.test("member of derived class object");
derived_friend(); derived_friend();
cout << "\n"; std::cout << "\n";
} /* main */ } /* main */
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
// Message-ID: <9308121348.aa26256@Paris.ics.uci.edu> // Message-ID: <9308121348.aa26256@Paris.ics.uci.edu>
// 5.cc // 5.cc
#include <stream.h> #include <iostream>
class A { class A {
int x; int x;
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
// Date: Wed, 17 Nov 93 21:30:32 EST // Date: Wed, 17 Nov 93 21:30:32 EST
// Subject: gcc 2.5.3 - can't privately inherit and contain same class // Subject: gcc 2.5.3 - can't privately inherit and contain same class
// Message-ID: <9311171030.AA00604@mencon> // Message-ID: <9311171030.AA00604@mencon>
#include <iostream.h> #include <iostream>
class A { class A {
public: public:
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
// Date: Wed, 21 Apr 93 09:42:07 +0100 // Date: Wed, 21 Apr 93 09:42:07 +0100
// Subject: /*** BUG REPORT : THE MYTH OF PRIVATE INHERITANCE ***/ // Subject: /*** BUG REPORT : THE MYTH OF PRIVATE INHERITANCE ***/
// Message-ID: <9304210842.AA01815@life.ai.mit.edu> // Message-ID: <9304210842.AA01815@life.ai.mit.edu>
#include <iostream.h> #include <iostream>
class A { class A {
private: private:
...@@ -64,8 +64,10 @@ int main() ...@@ -64,8 +64,10 @@ int main()
B* bobject = new B(2, 1); B* bobject = new B(2, 1);
C* cobject = new C(bobject); C* cobject = new C(bobject);
cobject->setBValue(8); cobject->setBValue(8);
cout << cobject->getBValue() << endl; std::cout << cobject->getBValue() << std::endl;
delete bobject; delete bobject;
delete cobject; delete cobject;
} }
...@@ -5,16 +5,16 @@ ...@@ -5,16 +5,16 @@
// libc-5.4.xx has __IO_putc in its static C library, which can conflict // libc-5.4.xx has __IO_putc in its static C library, which can conflict
// with the copy of __IO_putc in the libstdc++ library built by egcs. // with the copy of __IO_putc in the libstdc++ library built by egcs.
#include <iostream.h> #include <iostream>
#include <streambuf.h> #include <streambuf>
#include <stdio.h> #include <cstdio>
istream x (0); std::istream x (0);
main () { main () {
x.get(); x.get();
putc(0, 0); std::putc(0, 0);
fgets(0, 0, 0); std::fgets(0, 0, 0);
x.get((char*) 0, 0); x.get((char*) 0, 0);
} }
// Special g++ Options: -fexceptions // Special g++ Options: -fexceptions
// excess errors test - XFAIL a29k-*-* sparc64-*-elf arm-*-pe // excess errors test - XFAIL a29k-*-* sparc64-*-elf arm-*-pe
#include <stdlib.h> #include <cstdlib>
#include <iostream.h> #include <iostream>
class Vector { class Vector {
private: private:
...@@ -57,9 +57,9 @@ f(Vector& v) { ...@@ -57,9 +57,9 @@ f(Vector& v) {
try { try {
do_something( v ); do_something( v );
} catch (Vector::Range& r) { } catch (Vector::Range& r) {
cout << "Invalid vector range " << r.value() std::cout << "Invalid vector range " << r.value()
<< " caught in f()" << endl; << " caught in f()" << std::endl;
exit(0); std::exit(0);
} }
} }
...@@ -69,3 +69,6 @@ main() { ...@@ -69,3 +69,6 @@ main() {
f( v ); f( v );
return 1; return 1;
} }
// Build don't link: // Build don't link:
// Special g++ Options: -fsave-memoized // Special g++ Options: -fsave-memoized
#include <iostream.h> #include <iostream>
// Special g++ Options: // Special g++ Options:
#include <iostream.h> #include <iostream>
class foo { class foo {
public: public:
...@@ -25,10 +25,10 @@ class multiple : public bar_1, public bar_2 { ...@@ -25,10 +25,10 @@ class multiple : public bar_1, public bar_2 {
public: public:
multiple(int i1, int i2) : bar_1(i1), bar_2(i2) {} multiple(int i1, int i2) : bar_1(i1), bar_2(i2) {}
void print() { void print() {
cout << "bar_1::k -> " << bar_1::k << "\n"; std::cout << "bar_1::k -> " << bar_1::k << "\n";
cout << "bar_2::k -> " << bar_2::k << "\n"; std::cout << "bar_2::k -> " << bar_2::k << "\n";
cout << "bar_1::get_k() -> " << bar_1::get_k() << "\n"; std::cout << "bar_1::get_k() -> " << bar_1::get_k() << "\n";
cout << "bar_2::get_k() -> " << bar_2::get_k() << "\n"; std::cout << "bar_2::get_k() -> " << bar_2::get_k() << "\n";
} }
}; };
...@@ -36,3 +36,5 @@ int main() { ...@@ -36,3 +36,5 @@ int main() {
multiple m(1,2); multiple m(1,2);
m.print(); m.print();
} }
#include <iostream.h> #include <iostream>
#include <stdlib.h> #include <cstdlib>
#include <stddef.h> #include <cstddef>
#include <new> #include <new>
int fail = 1; int fail = 1;
...@@ -14,7 +14,7 @@ void *operator new(size_t size) throw (std::bad_alloc) { ...@@ -14,7 +14,7 @@ void *operator new(size_t size) throw (std::bad_alloc) {
} }
int main() { int main() {
cout << ""; std::cout << "";
in_main = 1; in_main = 1;
new int; new int;
return fail; return fail;
......
// prms-id: 658 // prms-id: 658
#include <ostream.h> #include <iostream>
#include <stdlib.h> #include <cstdlib>
/* We may not find the libg++ <bool.h>. */ /* We may not find the libg++ <bool.h>. */
#ifndef FALSE #ifndef FALSE
...@@ -65,8 +65,8 @@ void ...@@ -65,8 +65,8 @@ void
Object::OK() const Object::OK() const
{ {
if (_destructed) { if (_destructed) {
cerr << "FAILURE - reference was made to a destructed object\n"; std::cerr << "FAILURE - reference was made to a destructed object\n";
abort(); std::abort();
} }
} }
...@@ -98,3 +98,5 @@ Char::operator char () const ...@@ -98,3 +98,5 @@ Char::operator char () const
{ {
return _c; return _c;
} }
// Build don't link: // Build don't link:
#include <typeinfo> #include <typeinfo>
#include <iostream.h> #include <iostream>
// Special g++ Options: -O2 // Special g++ Options: -O2
#include <iostream.h> #include <iostream>
ostream& foo (char *x, ostream &y) std::ostream& foo (char *x, std::ostream &y)
{ {
return y << "" << x; return y << "" << x;
} }
int main () int main ()
{ {
foo ("", cout); foo ("", std::cout);
} }
#include<map> #include<map>
#include<iostream.h> #include<iostream>
#include<vector> #include<vector>
#include<string> #include<string>
using namespace std;
// empty parameter class with a minimal set of operations // empty parameter class with a minimal set of operations
// if there are no weights for edges necessary // if there are no weights for edges necessary
struct Empty struct Empty
......
// Build don't link: // Build don't link:
#include <iostream.h> #include <iostream>
class X : public std::streambuf class X : public std::streambuf
{ {
......
// Special g++ Options: -O // Special g++ Options: -O
#include <iostream.h> #include <iostream>
#include <typeinfo> #include <typeinfo>
int main() { int main() {
int *i1, *i2; int *i1, *i2;
cerr << (typeid(i1)==typeid(i2)) << endl; std::cerr << (typeid(i1)==typeid(i2)) << std::endl;
} }
// Test for obsolete specialization syntax. Turn off -pedantic. // Test for obsolete specialization syntax. Turn off -pedantic.
// Special g++ Options: // Special g++ Options:
#include <iostream.h> #include <iostream>
#include <typeinfo> #include <typeinfo>
template <typename T> template <typename T>
...@@ -13,7 +13,7 @@ public: ...@@ -13,7 +13,7 @@ public:
template <typename T> template <typename T>
void void
A<T>::test(){ A<T>::test(){
cerr << "test for " << typeid(*this).name() << endl; std::cerr << "test for " << typeid(*this).name() << std::endl;
} }
// Specialization declaration // Specialization declaration
void void
...@@ -22,7 +22,7 @@ A<double>::test(); ...@@ -22,7 +22,7 @@ A<double>::test();
// Specialization definition // Specialization definition
void void
A<double>::test(){ A<double>::test(){
cerr << "specialization for " << typeid(*this).name() << endl; std::cerr << "specialization for " << typeid(*this).name() << std::endl;
} }
...@@ -35,3 +35,4 @@ main(){ ...@@ -35,3 +35,4 @@ main(){
return 0; return 0;
} }
// Build don't link: // Build don't link:
#include<iostream.h> #include<iostream>
#include<stddef.h> #include<cstddef>
struct A { struct A {
A() { A() {
cerr<<"A constructing\n"; std::cerr<<"A constructing\n";
throw 1; throw 1;
} }
void *operator new(size_t sz) { void *operator new(size_t sz) {
cerr<<"A allocated\n"; std::cerr<<"A allocated\n";
return ::operator new(sz); return ::operator new(sz);
} }
void operator delete (void *p) { void operator delete (void *p) {
cerr<<"A deleted\n"; std::cerr<<"A deleted\n";
::operator delete (p); ::operator delete (p);
} }
}; };
...@@ -23,3 +23,6 @@ int main() { ...@@ -23,3 +23,6 @@ int main() {
} catch (...) { } catch (...) {
} }
} }
#include <vector> #include <vector>
#include <strstream.h> #include <sstream>
using namespace std; using namespace std;
...@@ -16,7 +16,7 @@ std::vector<connection_t> connections; ...@@ -16,7 +16,7 @@ std::vector<connection_t> connections;
int int
main() { main() {
ostrstream str; ostringstream str;
connections.insert(connections.end(), connection_t()); connections.insert(connections.end(), connection_t());
......
// Build don't link: // Build don't link:
#include <iostream.h> #include <iostream>
template < class T > template < class T >
class X class X
...@@ -19,5 +19,5 @@ class Y : public X<T> ...@@ -19,5 +19,5 @@ class Y : public X<T>
using X<T>::x; using X<T>::x;
void f () { cout << x << endl; } void f () { std::cout << x << std::endl; }
}; };
// Build don't link: // Build don't link:
#include <complex.h> #include <complex>
template<class T> template<class T>
class Vec { class Vec {
public: public:
...@@ -8,4 +8,4 @@ public: ...@@ -8,4 +8,4 @@ public:
void operator=(const Vec<T> &v) { data = new T; } void operator=(const Vec<T> &v) { data = new T; }
T *data; T *data;
}; };
template class Vec<complex<double> >; template class Vec<std::complex<double> >;
// Build don't link: // Build don't link:
#include <fstream.h> #include <fstream>
class bifstream : public ifstream { class bifstream : public std::ifstream {
public: public:
bifstream(); bifstream();
// ~bifstream(); // ~bifstream();
......
#include<iostream.h> #include<iostream>
int main() { int main() {
try { try {
...@@ -15,3 +15,5 @@ int main() { ...@@ -15,3 +15,5 @@ int main() {
} }
return 0; return 0;
} }
#include <fstream.h> #include <fstream>
#include <stdio.h> #include <cstdio>
int int
main() main()
{ {
printf("If you see this, you don't have a problem!\n"); std::printf("If you see this, you don't have a problem!\n");
#ifdef EXPOSE_BUG #ifdef EXPOSE_BUG
ifstream a; std::ifstream a;
#endif #endif
} }
// Build don't link: // Build don't link:
#include <ctype.h> #include <cctype>
#include <iostream.h> #include <iostream>
// #include <streambuf.h> #include <sstream>
// #include <libio.h> #include <cstring>
#include <strstream.h>
#include <string.h>
using namespace std; using namespace std;
...@@ -13,7 +11,8 @@ extern bool foo2 (ostream &out, istream &in); ...@@ -13,7 +11,8 @@ extern bool foo2 (ostream &out, istream &in);
bool bool
foo1 (ostream &out, const char *in) foo1 (ostream &out, const char *in)
{ {
strstreambuf sb (in, (int) strlen (in)); string tmp(in, strlen(in));
stringbuf sb (tmp);
istream fmt (&sb); istream fmt (&sb);
return foo2 (out, fmt); return foo2 (out, fmt);
} }
// Error: Internal Compiler Error in GCC 2.7.2 and EGCS 1998/05/28 snapshot. // Error: Internal Compiler Error in GCC 2.7.2 and EGCS 1998/05/28 snapshot.
#include <iostream.h> #include <iostream>
class some_base class some_base
{ {
...@@ -31,7 +31,7 @@ public: ...@@ -31,7 +31,7 @@ public:
class some_derived::func(derived_func_args &a) // ERROR - illegal member syntax class some_derived::func(derived_func_args &a) // ERROR - illegal member syntax
{ {
cout << a.i << ' ' << a.f << endl; std::cout << a.i << ' ' << a.f << std::endl;
} }
int int
......
#include <iostream.h> #include <iostream>
#include <iterator.h> #include <iterator>
#include <string> #include <string>
ostream_iterator<std::string> oo(cout); std::ostream_iterator<std::string> oo(std::cout);
int main() int main()
{ {
......
...@@ -4,9 +4,11 @@ ...@@ -4,9 +4,11 @@
// Also, the template instantiation does not provide the missing // Also, the template instantiation does not provide the missing
// friend function, the non-template function does // friend function, the non-template function does
#include <stdio.h> #include <cstdio>
#include <stdlib.h> #include <cstdlib>
#include <iostream.h> #include <iostream>
using namespace std;
template <class T> template <class T>
class Vector class Vector
......
#include <iostream.h> #include <iostream>
class A1 { class A1 {
friend class B; friend class B;
...@@ -22,6 +22,9 @@ int main() ...@@ -22,6 +22,9 @@ int main()
A1* a=new A3; A1* a=new A3;
B b(a); B b(a);
if (b.itsA) cout << "cast ok" << endl; else cout << "cast failed" << endl; if (b.itsA)
std::cout << "cast ok" << std::endl;
else
std::cout << "cast failed" << std::endl;
return 0; return 0;
} }
#include <iomanip.h> #include <iomanip>
#include <stdlib.h> #include <iostream>
#include <cstdlib>
int main() int main()
{ {
cout << setbase(3) << endl; std::cout << std::setbase(3) << std::endl;
exit (0); std::exit (0);
} }
...@@ -2,11 +2,11 @@ ...@@ -2,11 +2,11 @@
// Since the constructor is in streambuf.h, additional diagnostics are // Since the constructor is in streambuf.h, additional diagnostics are
// produced, which are not really supported in the old-deja framework // produced, which are not really supported in the old-deja framework
#include <strstream.h> #include <sstream>
void void
t( char* buf ) t( char* buf )
{ {
istrstream str = buf; //ERROR - inaccessible copy constructor std::istrstream str = buf; //ERROR - inaccessible copy constructor
} }
#include <assert.h> #include <cassert>
#include <iostream.h> #include <iostream>
int bar () int bar ()
{ {
...@@ -17,6 +17,10 @@ int main () ...@@ -17,6 +17,10 @@ int main ()
{ {
} }
// cout << "i = " << i << endl; // std::cout << "i = " << i << std::endl;
assert (i == 0) ; assert (i == 0) ;
} }
// Special g++ Options: -O -Wall // Special g++ Options: -O -Wall
// Depletes VM. // Depletes VM.
#include <iostream.h> #include <iostream>
#include <list> #include <list>
#include <algorithm> #include <algorithm>
using namespace std; using namespace std;
......
#include <stream.h> #include <iostream>
#include <strstream.h> #include <sstream>
using namespace std; using namespace std;
int int
main(int, char* []) main(int, char* [])
{ {
strstream s; stringstream s;
s << "line 1\nline 2\n\nline 4"; s << "line 1\nline 2\n\nline 4";
s << ends; s << std::ends;
int nLine = 0; int nLine = 0;
...@@ -22,7 +22,7 @@ main(int, char* []) ...@@ -22,7 +22,7 @@ main(int, char* [])
} }
++nLine; ++nLine;
cout << nLine << ": " << line << endl; std::cout << nLine << ": " << line << std::endl;
if( nLine > 10 ) { // stop infinite loop if( nLine > 10 ) { // stop infinite loop
break; break;
......
// Makes bogus x86 assembly code. // Makes bogus x86 assembly code.
#include <iostream.h> #include <iostream>
using namespace std;
template<class T> template<class T>
T max(T a, T b) T max(T a, T b)
......
// Skip if not native // Skip if not native
// Special g++ Options: -fprofile-arcs -ftest-coverage // Special g++ Options: -fprofile-arcs -ftest-coverage
void void
swap(int& x, int& y) throw() test_swap(int& x, int& y) throw()
{ {
int tmp = x; int tmp = x;
x = y; x = y;
...@@ -12,5 +12,5 @@ main() ...@@ -12,5 +12,5 @@ main()
{ {
int i = 5; int i = 5;
int j = 7; int j = 7;
swap(i, j); test_swap(i, j);
} }
...@@ -3,10 +3,11 @@ ...@@ -3,10 +3,11 @@
// Special g++ Options: -O -Winline // Special g++ Options: -O -Winline
// Build don't link: // Build don't link:
#include <iomanip.h> #include <iomanip>
#include <iostream>
void void
f() f()
{ {
cout << setw(3); std::cout << std::setw(3);
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment