URL
https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk
Subversion Repositories openrisc_2011-10-31
[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.2.2/] [gcc/] [testsuite/] [g++.old-deja/] [g++.law/] [dtors2.C] - Rev 154
Compare with Previous | Blame | View Log
// { dg-do run }
// GROUPS passed destructors
#include <stdio.h>
int destruct = 0;
class bla {
public:
inline bla(const char * jim) { ; };
inline ~bla() { destruct++; if (destruct == 2) printf ("PASS\n");};
};
class ulk {
public:
inline ulk() {};
inline ~ulk() {};
void funk(const bla & bob) { ;};
// ^ interestingly, the code compiles right if
// this & is deleted (and therefore the parameter
// passed as value)
};
int main() {
ulk dumm;
dumm.funk(bla("laberababa")); // this compiles correctly
dumm.funk((bla)"laberababa"); // this produces incorrect code -
// the temporary instance of
// the class "bla" is constructed
// but never destructed...
}