URL
https://opencores.org/ocsvn/openrisc/openrisc/trunk
Subversion Repositories openrisc
[/] [openrisc/] [tags/] [gnu-src/] [gcc-4.5.1/] [gcc-4.5.1-or32-1.0rc2/] [gcc/] [testsuite/] [g++.old-deja/] [g++.law/] [except3.C] - Rev 305
Go to most recent revision | Compare with Previous | Blame | View Log
// { dg-do assemble }
// { dg-options "-fexceptions" }
// GROUPS passed exceptions
// except file
// Message-Id: <9211301118.AA09810@ss670mp.geco.slb.com>
// From: willoch@ss670mp.oslo.sgp.slb.com (thorbjorn willoch)
// Subject: -fansi-exceptions bug
// Date: Mon, 30 Nov 92 11:18:05 GMT
extern "C" int printf(const char *, ...);
class Vector
{
int* p;
int sz;
public:
Vector(int s) { p = new int[sz=s]; }
~Vector() {delete [] p; }
int size() {return sz; }
class Range{};
int& operator[](int i);
};
int& Vector::operator[](int i)
{
if(0<=i && i<sz) return p[i];
throw Range();
}
void do_something(Vector& v)
{
int i = v[v.size()+10];
}
main()
{
Vector v(10);
try
{
do_something(v);
}
catch (Vector::Range)
{
printf("Range error exception\n");
}
}
Go to most recent revision | Compare with Previous | Blame | View Log