From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28937 invoked by alias); 30 Dec 2006 11:21:10 -0000 Received: (qmail 28893 invoked by alias); 30 Dec 2006 11:21:00 -0000 Date: Sat, 30 Dec 2006 11:21:00 -0000 Message-ID: <20061230112100.28892.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug c++/30331] a const member function can call a non_const member function without const_cast In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "gdr at integrable-solutions dot net" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2006-12/txt/msg02092.txt.bz2 ------- Comment #2 from gdr at integrable-solutions dot net 2006-12-30 11:21 ------- Subject: Re: New: a const member function can call a non_const member function without const_cast "hongleij at 126 dot com" writes: | //const_test.cpp | struct A | { | A(unsigned int n) | { | aa=n; | } | void const_fun() const | { | static_cast(*this).fun(); //ok yes, as mandated by C++ semantics -- the static_cast creates a new object to which fun() is applied. That is OK. | // fun(); //err direct call to fun() is an error. So, this PR does not report an error. It should be closed as "mistaken". -- Gaby -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30331