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

* [Bug c++/40750] Side-effect of member function call not produced in certain circumstances
  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 ` rguenth at gcc dot gnu dot org
  2009-12-26 19:10 ` paolo dot carlini at oracle dot com
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2009-07-15  9:41 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from rguenth at gcc dot gnu dot org  2009-07-15 09:41 -------
Confirmed.


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
           Keywords|                            |wrong-code
   Last reconfirmed|0000-00-00 00:00:00         |2009-07-15 09:41:03
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40750


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

* [Bug c++/40750] Side-effect of member function call not produced in certain circumstances
  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
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: paolo dot carlini at oracle dot com @ 2009-12-26 19:10 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from paolo dot carlini at oracle dot com  2009-12-26 19:10 -------
I find this disturbing. Let's CC Jason...


-- 

paolo dot carlini at oracle dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jason at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40750


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

* [Bug c++/40750] Side-effect of member function call not produced in certain circumstances
  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
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: fang at csl dot cornell dot edu @ 2009-12-30  3:57 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from fang at csl dot cornell dot edu  2009-12-30 03:57 -------
Also fails with g++-4.0.1 and g++-4.2.1 (i686-darwin10).

g++-3.4.6 rejects the example:
error: invalid type qualifier for non-member function type


-- 

fang at csl dot cornell dot edu changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |fang at csl dot cornell dot
                   |                            |edu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40750


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

* [Bug c++/40750] Side-effect of member function call not produced in certain circumstances
  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
                   ` (2 preceding siblings ...)
  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
  5 siblings, 0 replies; 7+ messages in thread
From: jason at gcc dot gnu dot org @ 2010-01-20 18:54 UTC (permalink / raw)
  To: gcc-bugs



-- 

jason at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |jason at gcc dot gnu dot org
                   |dot org                     |
             Status|NEW                         |ASSIGNED
   Last reconfirmed|2009-07-15 09:41:03         |2010-01-20 18:54:11
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40750


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

* [Bug c++/40750] Side-effect of member function call not produced in certain circumstances
  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
                   ` (3 preceding siblings ...)
  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
  5 siblings, 0 replies; 7+ messages in thread
From: jason at gcc dot gnu dot org @ 2010-01-20 21:30 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from jason at gcc dot gnu dot org  2010-01-20 21:30 -------
Subject: Bug 40750

Author: jason
Date: Wed Jan 20 21:30:20 2010
New Revision: 156084

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=156084
Log:
        PR c++/40750
        * decl.c (grokdeclarator): Clear type_quals for a member function
        declared using a typedef.  Don't complain about adding cv-quals
        to a function typedef in C++0x mode.

Added:
    trunk/gcc/testsuite/g++.dg/parse/fn-typedef1.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/decl.c
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/g++.dg/other/cv_func.C


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40750


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

* [Bug c++/40750] Side-effect of member function call not produced in certain circumstances
  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
                   ` (4 preceding siblings ...)
  2010-01-20 21:30 ` jason at gcc dot gnu dot org
@ 2010-01-20 21:59 ` jason at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: jason at gcc dot gnu dot org @ 2010-01-20 21:59 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from jason at gcc dot gnu dot org  2010-01-20 21:59 -------
Fixed for 4.5.


-- 

jason at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|---                         |4.5.0


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).