public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/55386] New: operator void called for class objects converted to void type.
@ 2012-11-19  1:13 meng at g dot clemson.edu
  2012-11-19  1:36 ` [Bug c++/55386] " paolo.carlini at oracle dot com
  2012-11-19  1:39 ` paolo.carlini at oracle dot com
  0 siblings, 2 replies; 3+ messages in thread
From: meng at g dot clemson.edu @ 2012-11-19  1:13 UTC (permalink / raw)
  To: gcc-bugs


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

             Bug #: 55386
           Summary: operator void called for class objects converted to
                    void type.
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: meng@g.clemson.edu


C++11 12.3.2/1 says that:
A conversion function is never used to convert a (possibly cv-qualified) object
to the (possibly cv-qualified) same object type (or a reference to it), to a
(possibly cv-qualified) base class of that type (or a reference to
it), or to (possibly cv-qualified) void.

The standard also puts a note at the end of same page which reads:
A conversion to void does not invoke any conversion function (5.2.9).

But the following program shows that g++ calls operator void for class objects
converted to the void type.

--------------------- BEGIN ---------------------
#include <iostream>

struct test
{
 operator void () const { std::cout << "test::operator void ()" << std::endl; }
};

int main ()
{
 test const t;
 (void)t; // calls test::operator void
 return 0;
}
---------------------  END  ---------------------

My command line:~/gcc/4.7.0/bin/c++ -std=c++11 -Wall -Wextra t.cc
My compiler version:~/gcc/4.7.0/bin/c++ -v
Reading specs from /home/meng/gcc/4.7.0/lib/gcc/i686-pc-linux-gnu/4.7.0/specs
COLLECT_GCC=/home/meng/gcc/4.7.0/bin/c++
COLLECT_LTO_WRAPPER=/home/meng/gcc/4.7.0/libexec/gcc/i686-pc-linux-gnu/4.7.0/lto-wrapper
Target: i686-pc-linux-gnu
Configured with: ./configure --prefix=/home/meng/gcc/4.7.0/
--enable-languages=c,c++
Thread model: posix
gcc version 4.7.0 (GCC)


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

* [Bug c++/55386] operator void called for class objects converted to void type.
  2012-11-19  1:13 [Bug c++/55386] New: operator void called for class objects converted to void type meng at g dot clemson.edu
@ 2012-11-19  1:36 ` paolo.carlini at oracle dot com
  2012-11-19  1:39 ` paolo.carlini at oracle dot com
  1 sibling, 0 replies; 3+ messages in thread
From: paolo.carlini at oracle dot com @ 2012-11-19  1:36 UTC (permalink / raw)
  To: gcc-bugs


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

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|meng at g dot clemson.edu   |

--- Comment #1 from Paolo Carlini <paolo.carlini at oracle dot com> 2012-11-19 01:36:27 UTC ---
This is already fixed in mainline.


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

* [Bug c++/55386] operator void called for class objects converted to void type.
  2012-11-19  1:13 [Bug c++/55386] New: operator void called for class objects converted to void type meng at g dot clemson.edu
  2012-11-19  1:36 ` [Bug c++/55386] " paolo.carlini at oracle dot com
@ 2012-11-19  1:39 ` paolo.carlini at oracle dot com
  1 sibling, 0 replies; 3+ messages in thread
From: paolo.carlini at oracle dot com @ 2012-11-19  1:39 UTC (permalink / raw)
  To: gcc-bugs


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

Paolo Carlini <paolo.carlini at oracle dot com> changed:

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

--- Comment #2 from Paolo Carlini <paolo.carlini at oracle dot com> 2012-11-19 01:39:28 UTC ---
Closing.

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


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

end of thread, other threads:[~2012-11-19  1:39 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-11-19  1:13 [Bug c++/55386] New: operator void called for class objects converted to void type meng at g dot clemson.edu
2012-11-19  1:36 ` [Bug c++/55386] " paolo.carlini at oracle dot com
2012-11-19  1:39 ` paolo.carlini at oracle dot com

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