OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [tags/] [gnu-src/] [gcc-4.5.1/] [gcc-4.5.1-or32-1.0rc1/] [gcc/] [testsuite/] [g++.old-deja/] [g++.law/] [dtors2.C] - Blame information for rev 338

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 305 jeremybenn
// { dg-do run  }
2
// GROUPS passed destructors
3
#include 
4
 
5
int destruct = 0;
6
 
7
class bla {
8
 
9
public:
10
 
11
        inline bla(const char * jim) { ; }
12
 
13
        inline ~bla() { destruct++; if (destruct == 2) printf ("PASS\n");}
14
};
15
 
16
class ulk {
17
 
18
public:
19
 
20
        inline ulk() {}
21
        inline ~ulk() {}
22
 
23
        void funk(const bla & bob) { ;}
24
             //       ^ interestingly, the code compiles right if
25
             //         this & is deleted (and therefore the parameter
26
             //         passed as value)
27
};
28
 
29
int main() {
30
 
31
        ulk dumm;
32
 
33
        dumm.funk(bla("laberababa"));  // this compiles correctly
34
 
35
        dumm.funk((bla)"laberababa");  // this produces incorrect code -
36
                                       // the temporary instance of
37
                                       // the class "bla" is constructed
38
                                       // but never destructed...
39
 
40
 
41
}

powered by: WebSVN 2.1.0

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