public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/21762] New: Void functions can't return invocation of pointers to void member functions
@ 2005-05-26  5:44 donaldc at csgsolar dot com dot au
  2005-05-26  5:51 ` [Bug c++/21762] Regression: " donaldc at csgsolar dot com dot au
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: donaldc at csgsolar dot com dot au @ 2005-05-26  5:44 UTC (permalink / raw)
  To: gcc-bugs

Formally: The check to see if a function returns void fails when you have a
member function pointer of a class of incomplete type.

The following code fails to compile on gcc 4.0.0
This is a regression. It compiled on gcc 3.x, and 2.95
It also compiles on MSVC7,7.1,8.0, Intel (x86 + Itanium), Digital Mars, Comeau,
Metrowerks 7, Borland, Open Watcom, PGI.

Although it is an obscure bug, it is important for my 'FastDelegate' library at
CodeProject, which has become extremely popular -- a surprising number of people
are affected by this bug.

bug.cpp: In function 'void failingfunc()':
bug.cpp:13: error: return-statement with a value, in function returning 'void'
--------------------------------------
// works on gcc 3.x, and all other compilers.
// if change 'void' to 'int', it works.
// if change 'class A;' to 'class A{};', it works.

class A;

typedef void (A::*VoidMemFn)();

void failingfunc() {
	A *p;
	VoidMemFn z;
	return (p->*z)();
}

int main(void)
{
  failingfunc();
  return 0;
}

-- 
           Summary: Void functions can't return invocation of pointers to
                    void member functions
           Product: gcc
           Version: 4.0.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: donaldc at csgsolar dot com dot au
                CC: gcc-bugs at gcc dot gnu dot org


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


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

* [Bug c++/21762] Regression: Void functions can't return invocation of pointers to void member functions
  2005-05-26  5:44 [Bug c++/21762] New: Void functions can't return invocation of pointers to void member functions donaldc at csgsolar dot com dot au
@ 2005-05-26  5:51 ` donaldc at csgsolar dot com dot au
  2005-05-26 12:20 ` [Bug c++/21762] [4.0/4.1 Regression] void return with pointer to member function to undefined class pinskia at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: donaldc at csgsolar dot com dot au @ 2005-05-26  5:51 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|Void functions can't return |Regression: Void functions
                   |invocation of pointers to   |can't return invocation of
                   |void member functions       |pointers to void member
                   |                            |functions


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


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

* [Bug c++/21762] [4.0/4.1 Regression] void return with pointer to member function to undefined class
  2005-05-26  5:44 [Bug c++/21762] New: Void functions can't return invocation of pointers to void member functions donaldc at csgsolar dot com dot au
  2005-05-26  5:51 ` [Bug c++/21762] Regression: " donaldc at csgsolar dot com dot au
@ 2005-05-26 12:20 ` pinskia at gcc dot gnu dot org
  2005-05-28  2:30 ` mmitchel at gcc dot gnu dot org
  2005-05-28  2:30 ` mmitchel at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-05-26 12:20 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-05-26 12:18 -------
Confirmed, very much related to PR 21614.  Changing the undefined class to a defined class makes the 
code work.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |pinskia at gcc dot gnu dot
                   |                            |org
  BugsThisDependsOn|                            |21614
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
           Keywords|                            |rejects-valid
   Last reconfirmed|0000-00-00 00:00:00         |2005-05-26 12:18:23
               date|                            |
            Summary|Regression: Void functions  |[4.0/4.1 Regression] void
                   |can't return invocation of  |return with pointer to
                   |pointers to void member     |member function to undefined
                   |functions                   |class
   Target Milestone|---                         |4.0.1


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


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

* [Bug c++/21762] [4.0/4.1 Regression] void return with pointer to member function to undefined class
  2005-05-26  5:44 [Bug c++/21762] New: Void functions can't return invocation of pointers to void member functions donaldc at csgsolar dot com dot au
  2005-05-26  5:51 ` [Bug c++/21762] Regression: " donaldc at csgsolar dot com dot au
  2005-05-26 12:20 ` [Bug c++/21762] [4.0/4.1 Regression] void return with pointer to member function to undefined class pinskia at gcc dot gnu dot org
@ 2005-05-28  2:30 ` mmitchel at gcc dot gnu dot org
  2005-05-28  2:30 ` mmitchel at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2005-05-28  2:30 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From mmitchel at gcc dot gnu dot org  2005-05-28 02:30 -------


*** This bug has been marked as a duplicate of 21614 ***

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |DUPLICATE


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


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

* [Bug c++/21762] [4.0/4.1 Regression] void return with pointer to member function to undefined class
  2005-05-26  5:44 [Bug c++/21762] New: Void functions can't return invocation of pointers to void member functions donaldc at csgsolar dot com dot au
                   ` (2 preceding siblings ...)
  2005-05-28  2:30 ` mmitchel at gcc dot gnu dot org
@ 2005-05-28  2:30 ` mmitchel at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2005-05-28  2:30 UTC (permalink / raw)
  To: gcc-bugs



-- 
Bug 21762 depends on bug 21614, which changed state.

Bug 21614 Summary: [4.0/4.1 regression] wrong code when calling member function of undefined class
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21614

           What    |Old Value                   |New Value
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED

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


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

end of thread, other threads:[~2005-05-28  2:30 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-05-26  5:44 [Bug c++/21762] New: Void functions can't return invocation of pointers to void member functions donaldc at csgsolar dot com dot au
2005-05-26  5:51 ` [Bug c++/21762] Regression: " donaldc at csgsolar dot com dot au
2005-05-26 12:20 ` [Bug c++/21762] [4.0/4.1 Regression] void return with pointer to member function to undefined class pinskia at gcc dot gnu dot org
2005-05-28  2:30 ` mmitchel at gcc dot gnu dot org
2005-05-28  2:30 ` mmitchel 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).