[Bug c++/40750] New: Side-effect of member function call not produced in certain circumstances
schaub-johannes at web dot de
gcc-bugzilla@gcc.gnu.org
Tue Jul 14 18:15:00 GMT 2009
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
More information about the Gcc-bugs
mailing list