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