URL
https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk
Only display areas with differences |
Details |
Blame |
View Log
Rev 149 |
Rev 154 |
// PR c++/25979
|
// PR c++/25979
|
// Bug: we were eliding too many temporaries, so that a1 was used
|
// Bug: we were eliding too many temporaries, so that a1 was used
|
// as both 'a' and 'x' in the second operator+.
|
// as both 'a' and 'x' in the second operator+.
|
// { dg-do run }
|
// { dg-do run }
|
|
|
struct A
|
struct A
|
{
|
{
|
A() : data1_(0), data2_(0) {}
|
A() : data1_(0), data2_(0) {}
|
A(int i, int j) : data1_(i), data2_(j) {}
|
A(int i, int j) : data1_(i), data2_(j) {}
|
A operator+(int);
|
A operator+(int);
|
friend A operator+(int, const A&);
|
friend A operator+(int, const A&);
|
~A() {}
|
~A() {}
|
//private:
|
//private:
|
int data1_;
|
int data1_;
|
int data2_;
|
int data2_;
|
};
|
};
|
|
|
extern bool x;
|
extern bool x;
|
|
|
extern "C" void abort ();
|
extern "C" void abort ();
|
|
|
int main()
|
int main()
|
{
|
{
|
A a1(1,2);
|
A a1(1,2);
|
a1 = (x ? a1 + 3 : 3 + a1);
|
a1 = (x ? a1 + 3 : 3 + a1);
|
if (a1.data1_ != 3 || a1.data2_ != 2)
|
if (a1.data1_ != 3 || a1.data2_ != 2)
|
abort ();
|
abort ();
|
}
|
}
|
|
|
bool x = false;
|
bool x = false;
|
|
|
A
|
A
|
A::operator+(int i)
|
A::operator+(int i)
|
{
|
{
|
A a;
|
A a;
|
a = *this;
|
a = *this;
|
a.data2_ = i;
|
a.data2_ = i;
|
return a;
|
return a;
|
}
|
}
|
|
|
A
|
A
|
operator+(int i, const A& x)
|
operator+(int i, const A& x)
|
{
|
{
|
A a;
|
A a;
|
a = x;
|
a = x;
|
a.data1_ = i;
|
a.data1_ = i;
|
return a;
|
return a;
|
}
|
}
|
|
|
© copyright 1999-2024
OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.