OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [g++.dg/] [opt/] [nrv10.C] - Blame information for rev 693

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 693 jeremybenn
// PR c++/25979
2
// Bug: we were eliding too many temporaries, so that a1 was used
3
// as both 'a' and 'x' in the second operator+.
4
// { dg-do run }
5
 
6
struct A
7
{
8
    A() : data1_(0), data2_(0) {}
9
    A(int i, int j) : data1_(i), data2_(j) {}
10
    A operator+(int);
11
    friend A operator+(int, const A&);
12
    ~A() {}
13
//private:
14
    int data1_;
15
    int data2_;
16
};
17
 
18
extern bool x;
19
 
20
extern "C" void abort ();
21
 
22
int main()
23
{
24
    A a1(1,2);
25
    a1 = (x ? a1 + 3 : 3 + a1);
26
    if (a1.data1_ != 3 || a1.data2_ != 2)
27
      abort ();
28
}
29
 
30
bool x = false;
31
 
32
A
33
A::operator+(int i)
34
{
35
    A a;
36
    a = *this;
37
    a.data2_ = i;
38
    return a;
39
}
40
 
41
A
42
operator+(int i, const A& x)
43
{
44
    A a;
45
    a = x;
46
    a.data1_ = i;
47
    return a;
48
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.