| 1 |
/* { dg-do run } */ |
| 2 |
|
| 3 |
extern "C" void abort (void); |
| 4 |
class XalanDOMString |
| 5 |
{ |
| 6 |
public: |
| 7 |
int y; |
| 8 |
}; |
| 9 |
|
| 10 |
class XObject |
| 11 |
{ |
| 12 |
public: |
| 13 |
const XalanDOMString& str() const { return x; } |
| 14 |
XalanDOMString x; |
| 15 |
}; |
| 16 |
|
| 17 |
class XObjectPtr |
| 18 |
{ |
| 19 |
public: |
| 20 |
XObjectPtr(const XObjectPtr& theSource) |
| 21 |
{ |
| 22 |
m_xobjectPtr = theSource.m_xobjectPtr; |
| 23 |
} |
| 24 |
const XObject* operator->() const |
| 25 |
{ |
| 26 |
return m_xobjectPtr; |
| 27 |
}; |
| 28 |
XObjectPtr(XObject *p) { m_xobjectPtr = p; } |
| 29 |
XObject* m_xobjectPtr; |
| 30 |
}; |
| 31 |
|
| 32 |
class FunctionSubstringBefore |
| 33 |
{ |
| 34 |
public: |
| 35 |
int execute( const XObjectPtr arg1) const |
| 36 |
{ |
| 37 |
const XalanDOMString& theFirstString = arg1->str(); |
| 38 |
return theFirstString.y; |
| 39 |
} |
| 40 |
}; |
| 41 |
|
| 42 |
int |
| 43 |
main () |
| 44 |
{ |
| 45 |
XObject x; |
| 46 |
XObjectPtr y (&x); |
| 47 |
x.x.y = -1; |
| 48 |
FunctionSubstringBefore z; |
| 49 |
if (z.execute (y) != -1) |
| 50 |
abort (); |
| 51 |
return 0; |
| 52 |
} |