From-SVN: r23435
This commit is contained in:
Jason Merrill 1998-10-29 16:23:53 -05:00
parent 384278ddcd
commit 1a7a342d99
2 changed files with 46 additions and 0 deletions

View File

@ -0,0 +1,30 @@
// Test for bad loop optimization of goto fixups.
// Special g++ Options: -O2
typedef bool (*ftype) ();
int c, d;
struct A {
A() { ++c; }
A(const A&) { ++c; }
~A() { ++d; }
};
void f (ftype func)
{
A a;
do {
if ((*func)()) return;
} while (true);
}
bool test ()
{
return true;
}
main ()
{
f (test);
return (c != d);
}

View File

@ -0,0 +1,16 @@
// Build don't link:
class A
{
private:
int myInt;
public:
A& operator = (int right) {myInt = right; return *this;}
};
union B
{
char f1;
A f2; // gets bogus error - non-copy assignment op is OK
};