home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!cse.ucsc.EDU!dlong
- From: dlong@cse.ucsc.EDU (Dean R. E. Long)
- Newsgroups: gnu.g++.bug
- Subject: g++ 2.3.3 const non-warning
- Date: 22 Jan 1993 21:45:33 -0500
- Organization: University of California, Santa Cruz (CE/CIS Boards)
- Lines: 22
- Sender: daemon@cis.ohio-state.edu
- Approved: bug-g++@prep.ai.mit.edu
- Distribution: gnu
- Message-ID: <1jpmd4INN56o@darkstar.UCSC.EDU>
-
- 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!
- }
-
-