🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.g++.bug
Article #462

(none)

#462
From: kenneth baclawski
Date: Wed, 04 Oct 1989 00:28
62 lines
1945 bytes
/*
     Problem with GNU C++ virtual conversion operators

Compilation:
g++ -v conv_op.c -o conv_op
g++ version 1.35.1-
 /kens-disk/k/gnu/lib/gcc-cpp -+ -v -undef -D__GNU__ -D__GNUG__ -D__cplusplus -Dmc68000 -Dsun -Dunix -D__mc68000__ -D__sun__ -D__unix__ -D__HAVE_68881__ -Dmc68020 conv_op.c /tmp/cca08205.cpp
GNU CPP version 1.35
 /kens-disk/k/gnu/lib/gcc-cc1plus /tmp/cca08205.cpp -quiet -dumpbase conv_op.c -noreg -version -o /tmp/cca08205.s
GNU C++ version 1.35.1- (68k, MIT syntax) compiled by GNU C version 1.35.
 as -mc68020 /tmp/cca08205.s -o conv_op.o
 /kens-disk/k/gnu/lib/gcc-ld++ -o conv_op -C -e __start -dc -dp /kens-disk/k/gnu/lib/crt0+.o /kens-disk/k/gnu/lib/Mcrt1.o conv_op.o -lg++ /kens-disk/k/gnu/lib/gcc-gnulib -lc

Output:
z::convert()
y::convert()
z::operator x()
z::operator x()
z::operator x()
z::operator x()
...

Output using AT&T C++:
z::convert()
y::convert()
z::operator x()
y::operator x()

*/

extern void printf (const char*, ...);

class x { 
  int a;

public:
  x (int i) { a = i; }
};

class y {
  int b;

public:
  y (int j) { b = j; }
  virtual operator x() { printf ("y::operator x()\n"); return x(b); }
  virtual x convert() { printf ("y::convert()\n"); return x(b); }
};

class z : public y {

public:
  z (int k) : (k) {}
  operator x() { printf ("z::operator x()\n"); return y::operator x(); }
  x convert() { printf ("z::convert()\n"); return y::convert(); }
};

main()
{
  z g = 1;
  g.convert();
  (x) g;
}
Technical Details
Message-ID: <8910040028.AA01285@flora.CCS.Northeastern.EDU>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!uwm.edu!gem.mps.ohio-state.edu!tut.cis.ohio-state.edu!flora.ccs.northeastern.edu!kenb

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!uwm.edu!gem.mps.ohio-state.edu!tut.cis.ohio-state.edu!flora.ccs.northeastern.edu!kenb
From: kenb@flora.ccs.northeastern.edu (kenneth baclawski)
Newsgroups: gnu.g++.bug
Subject: (none)
Message-ID: <8910040028.AA01285@flora.CCS.Northeastern.EDU>
Date: 4 Oct 89 00:28:28 GMT
Sender: daemon@tut.cis.ohio-state.edu
Distribution: gnu
Organization: GNUs Not Usenet
Lines: 62