public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/40750]  New: Side-effect of member function call not produced in certain circumstances
@ 2009-07-14 18:15 schaub-johannes at web dot de
  2009-07-15  9:41 ` [Bug c++/40750] " rguenth at gcc dot gnu dot org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: schaub-johannes at web dot de @ 2009-07-14 18:15 UTC (permalink / raw)
  To: gcc-bugs

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


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2010-01-20 21:59 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-07-14 18:15 [Bug c++/40750] New: Side-effect of member function call not produced in certain circumstances schaub-johannes at web dot de
2009-07-15  9:41 ` [Bug c++/40750] " rguenth at gcc dot gnu dot org
2009-12-26 19:10 ` paolo dot carlini at oracle dot com
2009-12-30  3:57 ` fang at csl dot cornell dot edu
2010-01-20 18:54 ` jason at gcc dot gnu dot org
2010-01-20 21:30 ` jason at gcc dot gnu dot org
2010-01-20 21:59 ` jason at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).