Thread View: gnu.g++.bug
1 messages
1 total messages
Started by Per Mildner
Thu, 25 May 1989 03:15
3 Bugs
Author: Per Mildner
Date: Thu, 25 May 1989 03:15
Date: Thu, 25 May 1989 03:15
78 lines
1924 bytes
1924 bytes
I'm Per-Mildner@AIDA.CSD.UU.SE
Configuration:
SUN 4 with OS 4
tm.h -> config/tm-sparc+.h
md -> config/sparc.md
g++ version 1.35.0
g++ -Wall -O program.cc
1.
I don't know if this is a bug, but:
It would be useful if structures could have size zero.
This could eg be used ot inherit a bunch of static members.
#include <stream.h>
class foo {
static int x;
};
int main(int argc, char* argv[]) {
cout << "sizeof(foo)==" << sizeof(foo) << ".\n"; // says 1 on my system
return 0;
};
2.
class C {
public:
int slot;
friend int bug(C c) {return c.slot;}
};
/*
g++ -Wall -c friend-inline-bug.cc
friend-inline-bug.cc:4: warning: `int bug (struct C)' declared but never defined
I get this even if I actually use the function (it gets defined and
works ok).
*/
3.
#include <stream.h>
class base {
public:
long field;
virtual int f () {return 1*field;};
};
class derived : public base {
public:
int f () {return 2*field;}
};
struct foo {
base aa,bb;
};
void bug (base& a, base& b) {
cout << "a: " << a.f() << ", b: " << b.f() << ".\n";
struct foo aabb;
aabb.aa = a;
aabb.bb = b;
// This gives a segmentation fault.
// Similar circumstances did print but used base::f() for both structure components.
// (which might be the correct behaviour)
cout << "aabb.aa.f(): " << aabb.aa.f() << ", aabb.bb.f(): " << aabb.bb.f() << ".\n";
};
int main(int argc, char* argv[]) {
base b;
derived d;
b.field=2;
d.field=11;
bug(b,d);
return 0;
};
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