🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by Dean R. E. Long Sat, 23 Jan 1993 02:45
g++ 2.3.3 const non-warning
#1402
Author: Dean R. E. Long
Date: Sat, 23 Jan 1993 02:45
21 lines
804 bytes
I would expect g++ to give me a warning for calling a non-const
member function with a const object in the following, but it does not:

class B {
    int x;
public:
    void foo(void) { x = 1; }
};

class A {
    B *p;
public:
    A() { p = 0; }
    const B & ro() { return *p; }
};

main()
{
    A a;
    a.ro().foo();	// warn me, please!
}
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