From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1901 invoked by alias); 14 Jul 2009 18:15:59 -0000 Received: (qmail 1382 invoked by uid 48); 14 Jul 2009 18:15:42 -0000 Date: Tue, 14 Jul 2009 18:15:00 -0000 Subject: [Bug c++/40750] New: Side-effect of member function call not produced in certain circumstances X-Bugzilla-Reason: CC Message-ID: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "schaub-johannes at web dot de" 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: 2009-07/txt/msg01139.txt.bz2 GCC mis-compiles the following code for mysterious reasons. While it should output "called", it outputs nothing at all // snip typedef void Fn() const; struct Foo { Fn fn; }; void Foo::fn() const { std::cout << "called" << std::endl; } int main() { Foo f; f.fn(); } // snap Any one of the following makes it show "called" properly: - Adding "inline" function specifier in the declaration of the function at class or namespace scope. - Replacing "Fn fn;" by a declaration with a function declarator "void fn() const;" - Making the function non-const (in the typedef and in the definition of the function). -- Summary: Side-effect of member function call not produced in certain circumstances Product: gcc Version: 4.4.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: schaub-johannes at web dot de GCC host triplet: i686-pc-linux-gnu GCC target triplet: i686-pc-linux-gnu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40750