2003-12-26 Guilhem Lavaux <guilhem@kaffe.org>
[official-gcc.git] / gcc / testsuite / g++.old-deja / g++.law / dtors2.C
blob7d8af475ba8862b0a3854b6adf3cda84a369dc66
1 // { dg-do run  }
2 // GROUPS passed destructors
3 #include <stdio.h>
5 int destruct = 0;
7 class bla {
9 public:
11         inline bla(char * jim) { ; };
13         inline ~bla() { destruct++; if (destruct == 2) printf ("PASS\n");};
16 class ulk {
18 public:
20         inline ulk() {};
21         inline ~ulk() {};
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)
29 int main() {
31         ulk dumm;
33         dumm.funk(bla("laberababa"));  // this compiles correctly
35         dumm.funk((bla)"laberababa");  // this produces incorrect code -
36                                        // the temporary instance of
37                                        // the class "bla" is constructed
38                                        // but never destructed...