3 // Bug: g++ gets confused trying to build up a reference to a cast.
10 String(const String &constStringRef);
11 virtual void virtualFn1(void) const {;}
14 String::String(char *incp)
19 String::String(const String &constStringRef)
21 // Right here, do an 'info args', and look at the virtual function table
22 // pointer: typically junk! Calling the function through that table could
23 // do anything, since we're really leaping off into the void. This example
24 // goes down with 'SIGBUS', but I've seen 'SIGSEGV' too, and 'SIGILL' is
27 cp = constStringRef.cp;
28 constStringRef.virtualFn1();
31 void foofun(String string)
38 Class1(const String & constStringRef);
41 Class1 :: Class1 (const String & constStringRef)
43 // If instead of calling the function 'foofun()' here, we just assign
44 // 'constStringRef' to a local variable, then the vptr is typically == 0!
46 foofun(String(constStringRef));
51 Class1 *class1 = new Class1("Hi!");