URL
https://opencores.org/ocsvn/openrisc/openrisc/trunk
Only display areas with differences |
Details |
Blame |
View Log
Rev 305 |
Rev 338 |
// { dg-do run }
|
// { dg-do run }
|
// { dg-options "-fexceptions" }
|
// { dg-options "-fexceptions" }
|
|
|
#include
|
#include
|
#include
|
#include
|
|
|
class A {
|
class A {
|
public:
|
public:
|
virtual void j () {}
|
virtual void j () {}
|
};
|
};
|
|
|
class B : public A { };
|
class B : public A { };
|
|
|
void x (A& a) {
|
void x (A& a) {
|
// These should all work.
|
// These should all work.
|
const B& b2 = dynamic_cast(a);
|
const B& b2 = dynamic_cast(a);
|
const B& b3 = dynamic_cast((const A&)a);
|
const B& b3 = dynamic_cast((const A&)a);
|
const B& b4 = dynamic_cast(a);
|
const B& b4 = dynamic_cast(a);
|
}
|
}
|
|
|
int main() {
|
int main() {
|
try {
|
try {
|
B b;
|
B b;
|
x (b);
|
x (b);
|
} catch (std::exception& e) {
|
} catch (std::exception& e) {
|
// If we get a bad_cast, it is wrong.
|
// If we get a bad_cast, it is wrong.
|
return 1;
|
return 1;
|
}
|
}
|
}
|
}
|
|
|
© copyright 1999-2024
OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.