Thread View: gnu.g++.bug
2 messages
2 total messages
Started by kenneth baclawski
Wed, 04 Oct 1989 00:28
(none)
Author: kenneth baclawski
Date: Wed, 04 Oct 1989 00:28
Date: Wed, 04 Oct 1989 00:28
62 lines
1945 bytes
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;
}
Re: (none)
Author: Doug Schmidt
Date: Wed, 04 Oct 1989 04:34
Date: Wed, 04 Oct 1989 04:34
30 lines
1392 bytes
1392 bytes
In article <8910040028.AA01285@flora.CCS.Northeastern.EDU>, kenb@flora (kenneth baclawski) writes:
>/*
> Problem with GNU C++ virtual conversion operators
[omitted]
You need to get the latest g++ (1.36.0-)
% /usr/gnu/g++ virt-test.cc -lg++
% a.out
z::convert()
y::convert()
z::operator x()
y::operator x()
Note also that you'll need to either
#include <stdio.h>
or say
extern "C" void printf (const char*, ...);
since g++ now mangles names a la cfront 2.0.
Doug
--
schmidt@ics.uci.edu (ARPA) | Per me si va nella citta' dolente.
office: (714) 856-4043 | Per me si va nell'eterno dolore.
| Per me si va tra la perduta gente.
| Lasciate ogni speranza o voi ch'entrate.
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads