+2000-06-12 Jason Merrill <jason@redhat.com>
+
+ * g++.old-deja/old-deja.exp: Add -Wno-long-long.
+
Fri Jun 9 22:46:34 2000 Jeffrey A Law (law@cygnus.com)
* gcc.c-torture/compile/20000609-1.c: New test.
// Special g++ Options: -Wsign-promo
// this test may only be valid for 32bit targets at present
+#include <limits.h>
+
enum e_i {
vali
}
enum_int;
enum e_ui {
+#if INT_MAX == 32767
+ valui = 0xF234
+#else
valui = 0xF2345678
+#endif
}
enum_uint;
int main ()
{
- caracas obj_ei ( enum_int ); // WARNING - // WARNING -
- caracas obj_eui ( enum_uint ); // WARNING - // WARNING -
+ caracas obj_ei ( enum_int ); // WARNING -
+ caracas obj_eui ( enum_uint ); // WARNING -
caracas obj_i ( i );
caracas obj_ui ( ui );
//test for bools with inclusive ors
#include <assert.h>
+
void bar ( bool x ) {};
void bars ( short x ) {};
return blob; //expect 65539, will be 3 if done in us type
}
-
int main() {
int tmp;
#if 0
assert (tmp ==27);
tmp = ors();
assert (tmp ==27);
- tmp = orus();
- assert (tmp == 65539);
+ if (sizeof (int) > 2 && sizeof (int) > sizeof (unsigned short))
+ {
+ tmp = orus();
+ assert (tmp == 65539);
+ }
return 0;
}
// Build don't link:
// GROUPS passed old-abort
#include <complex>
-typedef complex<double> Complex;
+typedef std::complex<double> Complex;
Complex ComputeVVself()
{
int
main(void) {
- string a[] = {"Hello"};
+ std::string a[] = {"Hello"};
}
// Special g++ Options:
+#include <limits.h>
+
int main ();
+#if INT_MAX > 32767
short s = (short) &main; // WARNING - small integer
+#endif
char c = (char) &main; // WARNING - small integer
int main () { return 0; }
// Check we can throw a bad_alloc exception when malloc dies
-static __SIZE_TYPE__ arena[100000]; // so things can initialize
+static __SIZE_TYPE__ arena[32767]; // so things can initialize
static int fail;
static unsigned pos;
extern "C" void *malloc (__SIZE_TYPE__ size)
{
- unsigned *p = &arena[pos];
+ __SIZE_TYPE__ *p = &arena[pos];
if (fail)
return 0;
}
catch (E *&e) {
- printf ("address of e is 0x%lx\n", (long)e);
- return !(long(e) != 5 && e->x == 5);
+ printf ("address of e is 0x%lx\n", (__SIZE_TYPE__)e);
+ return !((__SIZE_TYPE__)e != 5 && e->x == 5);
}
return 2;
}
// Test that attributes weak and alias coexist.
-// excess errors test - XFAIL alpha*-dec-osf*
+// excess errors test - XFAIL alpha*-dec-osf* *-hms
extern "C" {
void f () __attribute__((weak, alias ("_f")));
int main()
{
- char ArrA[10][10][20][30],
- ArrB[10][10][20][30];
+ char ArrA[1][1][2][3],
+ ArrB[1][1][2][3];
- void HitMe(char [10][10][20][30], char [10][10][20][30]);
+ void HitMe(char [1][1][2][3], char [1][1][2][3]);
HitMe(ArrA, ArrB);
return 0;
}
-void HitMe(char A[10][10][20][30], char B[10][10][20][30])
+void HitMe(char A[1][1][2][3], char B[1][1][2][3])
{
return;
}
}
template class std::__malloc_alloc_template<0>;
+#ifndef __USE_MALLOC
template class std::__default_alloc_template<false, 0>;
+#endif
// support, because it doesn't support variadic functions.
// Special g++ Options: -fvtable-thunks
-// excess errors test - XFAIL mips*-*-* rs6000-*-* powerpc-*-eabi m68k-*-coff m68k-motorola-sysv m88k-motorola-sysv3 mn10300-*-* mn10200-*-* v850-*-* sh-*-*
+// excess errors test - XFAIL mips*-*-* rs6000-*-* powerpc-*-eabi m68k-*-coff m68k-motorola-sysv m88k-motorola-sysv3 mn10300-*-* mn10200-*-* v850-*-* sh-*-* h8*
#include <stdarg.h>
// Special g++ Options: -W -Wall
struct A {
- unsigned int b : 28;
+ unsigned int b : 14;
};
int f (int i, unsigned char u, A a, unsigned long ul)
// Message-ID: <92Sep3.220137edt.30@jarvis.csri.toronto.edu>
#include <complex>
-typedef complex<double> Complex;
+typedef std::complex<double> Complex;
#include <stdio.h>
class Vector {
int main()
{
- bitset<sizeof(int) * 8> bufWord;
+ std::bitset<sizeof(int) * 8> bufWord;
bufWord[3] = 0;
}
line_error(int i):line(i){}
};
-#define CHECK(cond) if(!(cond))throw std::line_error(__LINE__);
+#define CHECK(cond) if(!(cond))throw line_error(__LINE__);
struct A{
A(int){
unsigned long bit = 1;
unsigned long sigignore = 0;
int i = 0;
- switch((unsigned long) (*p)->sigaction[i].sa_handler)
+ switch((__SIZE_TYPE__) (*p)->sigaction[i].sa_handler)
{
case 1:
sigignore |= bit;
#include <iostream.h>
+#include <stdlib.h>
#include <stddef.h>
#include <new>
int fail = 1;
+int in_main = 0;
+
void *operator new(size_t size) throw (std::bad_alloc) {
+ if (!in_main) return malloc (size);
--fail;
return (void*) 0;
}
int main() {
cout << "";
+ in_main = 1;
new int;
return fail;
}
}
namespace CXX {
- template<class T, int i1, int i2>
+ template<class T, long i1, long i2>
inline void qsort (T b[i1][i2], int (*cmp)(const T*, const T*)) {
::qsort ((void*)b, i1*i2, sizeof(T), (int (*)(const void *, const void *))cmp);
}
struct Foo {
~Foo() {
- std::exit(0);
+ exit(0);
}
};
int main() {
delete [] new Bar[1];
- std::abort();
+ abort();
}
}
~Foo() {
- std::exit(0);
+ exit(0);
}
};
int main() {
delete [] new Bar[2];
- std::abort();
+ abort();
}
struct Foo {
~Foo() {
- std::exit(0);
+ exit(0);
}
};
int main() {
Baz();
- std::abort();
+ abort();
}
struct Foo {
~Foo() {
- std::exit(0);
+ exit(0);
}
};
int main() {
foo();
- std::abort();
+ abort();
}
// by Alexandre Oliva <aoliva@cygnus.com>
-// execution test - XFAIL *-*-*
-
-extern "C" void abort (void);
-extern "C" void exit (int);
-
int i, j;
const int &f(const int& I, const int& J) {
}
int main () {
- if (&f(i, j) != &j)
- abort ();
- exit (0);
+ return (&f(i, j) != &j);
}
struct SomeClass { };
-void* operator new(size_t numBytes, SomeClass&, const nothrow_t&) throw()
+void* operator new(size_t numBytes, SomeClass&, const std::nothrow_t&) throw()
{
- return operator new(numBytes, nothrow);
+ return operator new(numBytes, std::nothrow);
}
-void operator delete(void* pMemory, SomeClass&, const nothrow_t&) throw()
+void operator delete(void* pMemory, SomeClass&, const std::nothrow_t&) throw()
{
i = 7;
return operator delete(pMemory);
void c() {
goto bar; // ERROR - jump from here
- vector<int> x; // ERROR - jump crosses initialization
+ std::vector<int> x; // ERROR - jump crosses initialization
bar: // ERROR - jump to here
;
}
int main()
{
double foo = 4.5;
- if (abs (0.5-abs (foo-0.5)) < 1e-10) foo+=1;
+ if (std::abs (0.5-std::abs (foo-0.5)) < 1e-10) foo+=1;
}
#include <list>
-list<int*> li;
+std::list<int*> li;
void f ()
{
#include <map>
#include <cstdlib>
+using namespace std;
+
class NAMES_ITEM
{
public:
#define NAME(OLD, NEW) NEW
#endif /* (!defined (__GXX_ABI_VERSION) || __GXX_ABI_VERSION < 100) */
-static unsigned int strlen (const char*) {} // ERROR - previous declaration
+static unsigned int strlen (const char*) {return 0;} // ERROR - previous declaration
int NAME (strlen__FPCc, _Z6strlenPKc) = 0; // ERROR - duplicate declaration
class Foo
{
public:
- Foo() { printf("Foo() 0x%08lx\n", (unsigned long)this); ++c; }
- Foo(Foo const &) { printf("Foo(Foo const &) 0x%08lx\n", (unsigned long)this); }
- ~Foo() { printf("~Foo() 0x%08lx\n", (unsigned long)this); ++d; }
+ Foo() { printf("Foo() 0x%08lx\n", (__SIZE_TYPE__)this); ++c; }
+ Foo(Foo const &) { printf("Foo(Foo const &) 0x%08lx\n", (__SIZE_TYPE__)this); }
+ ~Foo() { printf("~Foo() 0x%08lx\n", (__SIZE_TYPE__)this); ++d; }
};
// Bar creates constructs a temporary Foo() as a default
class Bar
{
public:
- Bar(Foo const & = Foo()) { printf("Bar(Foo const &) 0x%08lx\n", (unsigned long)this); }
+ Bar(Foo const & = Foo()) { printf("Bar(Foo const &) 0x%08lx\n", (__SIZE_TYPE__)this); }
};
void fakeRef(Bar *)
};
void f(S s);
-void f(type_info);
+void f(std::type_info);
void g()
{
// On targets that don't support weak symbols, we require an explicit
// instantiation of arr.
-// excess errors test - XFAIL *-*-aout *-*-coff *-*-hpux* alpha*-dec-osf*
+// excess errors test - XFAIL *-*-aout *-*-coff *-*-hpux* alpha*-dec-osf* *-*-hms
template<class T>
struct A {
{ // ERROR - candidates
public:
// public type interface
- typedef map<int, EdgeType > Successor;
- typedef pair<VertexType, Successor> vertex;
- typedef vector<vertex> GraphType;
+ typedef std::map<int, EdgeType > Successor;
+ typedef std::pair<VertexType, Successor> vertex;
+ typedef std::vector<vertex> GraphType;
typedef typename GraphType::iterator iterator;
typedef typename GraphType::const_iterator const_iterator;
int main()
{
// no edge weighting, therefore type Empty:
- Graph<string, Empty> V(true); // ERROR - no bool constructor
+ Graph<std::string, Empty> V(true); // ERROR - no bool constructor
// ReadGraph(V, "gra1.dat");
// display of vertices with successors
#include <vector>
#include<string>
+#include <iostream>
using namespace std;
#include <functional>
#include <algorithm>
#include <cassert>
+using namespace std;
int main()
{
list<int> l;
--- /dev/null
+// Build don't link:
+// Gives ICE on EGCS release branch as of 98/06/08 on i686-pc-linux-gnulibc1)
+// From: Klaus-Georg Adams <Klaus-Georg.Adams@chemie.uni-karlsruhe.de>
+// Message-Id: <199806081358.PAA02505@achibm5.chemie.uni-karlsruhe.de>
+#include <list>
+#include <functional>
+#include <algorithm>
+#include <cassert>
+int main()
+{
+ std::list<int> l;
+ l.push_back(1);
+ l.push_back(2);
+
+ std::list<int>::iterator it =
+ std::find_if( l.begin(), l.end(),
+ // This is a typo, it should be bind2nd, but an
+ // ICE is not a very helpful diagnostic!
+ std::binder2nd( std::equal_to<int>(), 2 ) ); // ERROR -
+ assert( *(it) == 2 );
+}
+
#include <string>
-string foo();
+std::string foo();
struct a {
void bar();
enum b { c, d };
b theb;
- string baz;
+ std::string baz;
};
void
// Build don't link:
+// Special g++ Options: -fno-honor-std
// Gives ICE 109
// From: Klaus-Georg Adams <Klaus-Georg.Adams@chemie.uni-karlsruhe.de>
// Reported against EGCS snaps 98/06/28.
--- /dev/null
+// Build don't link:
+// Gives ICE 109
+// From: Klaus-Georg Adams <Klaus-Georg.Adams@chemie.uni-karlsruhe.de>
+// Reported against EGCS snaps 98/06/28.
+
+int main()
+{
+ try {
+ }
+ catch (std::bad_alloc) { // ERROR - parse error
+ return 1;
+ }
+ return 0;
+}
+
+
--- /dev/null
+// Build don't link:
+// Gives ICE 109
+// From: Klaus-Georg Adams <Klaus-Georg.Adams@chemie.uni-karlsruhe.de>
+// Reported against EGCS snaps 98/06/28.
+
+using namespace std;
+
+int main()
+{
+ try {
+ }
+ catch (bad_alloc) { // ERROR - parse error
+ return 1;
+ }
+ return 0;
+}
+
+
connection_t() {}
};
-vector<connection_t> connections;
+std::vector<connection_t> connections;
/*----------------------------------------*/
#include <vector>
+using namespace std;
template <typename T=float> class foo {
public:
#include <iterator.h>
#include <string>
-ostream_iterator<string> oo(cout);
+ostream_iterator<std::string> oo(cout);
int main()
{
class Bug {
int pri:8;
- int flags:24;
+ int flags:15;
public:
void bug() {
flags |= a; // this does not work
#include <functional>
#endif
+using namespace std;
+
template<class R> int p( int val, R& r )
{
return val + r;
class t {
public:
- t(const string& s) : s_(s) {}
- string s_;
+ t(const std::string& s) : s_(s) {}
+ std::string s_;
static t* t_;
};
void f(void)
{
- vector<int> l(5, 0);
+ std::vector<int> l(5, 0);
}
#include <iterator>
+using namespace std;
+
template<size_t n, size_t i> struct PartialDotProduct {
template<class T>
static T Expand(T* a, T* b) { return T(); }
};
-vector <T> tp;
+std::vector <T> tp;
void f()
{
_eb91_u_int8_t c[2];
} val;
val.i = x;
- swap(val.c[0], val.c[1]);
+ std::swap(val.c[0], val.c[1]);
return val.i;
};
_eb91_int8_t c[2];
} val;
val.i = x;
- swap(val.c[0], val.c[1]);
+ std::swap(val.c[0], val.c[1]);
return val.i;
};
public:
-# Copyright (C) 1988, 90, 91, 92, 1994, 1997 Free Software Foundation, Inc.
+# Copyright (C) 1988, 90, 91, 92, 1994, 1997, 2000 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# When a testcase doesn't have any special options, use these.
if ![info exists DEFAULT_CXXFLAGS] {
- set DEFAULT_CXXFLAGS "-ansi -pedantic-errors"
+ set DEFAULT_CXXFLAGS "-ansi -pedantic-errors -Wno-long-long"
}