Remove old autovect-branch by moving to "dead" directory.
[official-gcc.git] / old-autovect-branch / gcc / testsuite / g++.old-deja / g++.jason / rvalue1.C
blobc3afd36fb6392fac9186dd72aef118e752057d29
1 // { dg-do run  }
2 // PRMS Id: 6000
3 // Bug: g++ gets confused trying to build up a reference to a cast.
5 class String {
6 protected:
7   char *cp;
8 public:
9   String(char *incp);
10   String(const String &constStringRef);
11   virtual void virtualFn1(void) const {;}
14 String::String(char *incp)
16   cp = 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
25 // possible.
27   cp = constStringRef.cp;
28   constStringRef.virtualFn1();
31 void foofun(String string)
33   ;
36 class Class1 {
37 public:
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));
49 int main(void)
51   Class1 *class1 = new Class1("Hi!");