public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/48557] New: [C++0x][SFINAE] Hard errors with void as operand of binary built-in operators
@ 2011-04-11 18:04 daniel.kruegler at googlemail dot com
  2011-04-12  7:52 ` [Bug c++/48557] " daniel.kruegler at googlemail dot com
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: daniel.kruegler at googlemail dot com @ 2011-04-11 18:04 UTC (permalink / raw)
  To: gcc-bugs

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

           Summary: [C++0x][SFINAE] Hard errors with void as operand of
                    binary built-in operators
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: daniel.kruegler@googlemail.com
                CC: jason@redhat.com
             Build: 4.7.0 20110409 (experimental)


The following program is well-formed, but should be well-formed according to
SFINAE rules:

//-----------------
template<class T>
struct add_rval_ref
{
  typedef T&& type;
};

template<>
struct add_rval_ref<void>
{
  typedef void type;
};

template<class T>
typename add_rval_ref<T>::type create();

template<class T, class U,
  class = decltype(create<T>() + create<U>())
>
char f(int);

template<class, class>
char (&f(...))[2];

static_assert(sizeof(f<void, int>(0)) != 1, "Error");  // (a)
//-----------------

The error message at (a) is:

"error: void value not ignored as it ought to be"

The same problem has been confirmed to exist for the following binary
operators:

+,-,*,/,%,<<,>>,==,!=,<,<=,>,>=,&,^,|,&&,||

It does *not* occur for the corresponding compounds assignments, like +=,
though


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

* [Bug c++/48557] [C++0x][SFINAE] Hard errors with void as operand of binary built-in operators
  2011-04-11 18:04 [Bug c++/48557] New: [C++0x][SFINAE] Hard errors with void as operand of binary built-in operators daniel.kruegler at googlemail dot com
@ 2011-04-12  7:52 ` daniel.kruegler at googlemail dot com
  2011-04-14 15:00 ` jason at gcc dot gnu.org
  2011-04-17  0:55 ` jason at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: daniel.kruegler at googlemail dot com @ 2011-04-12  7:52 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Daniel Krügler <daniel.kruegler at googlemail dot com> 2011-04-12 07:52:17 UTC ---
Oops: The first comment was supposed to mean:

"The following program is *ill-formed*, but should be well-formed according to
SFINAE rules:"


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

* [Bug c++/48557] [C++0x][SFINAE] Hard errors with void as operand of binary built-in operators
  2011-04-11 18:04 [Bug c++/48557] New: [C++0x][SFINAE] Hard errors with void as operand of binary built-in operators daniel.kruegler at googlemail dot com
  2011-04-12  7:52 ` [Bug c++/48557] " daniel.kruegler at googlemail dot com
@ 2011-04-14 15:00 ` jason at gcc dot gnu.org
  2011-04-17  0:55 ` jason at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: jason at gcc dot gnu.org @ 2011-04-14 15:00 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Jason Merrill <jason at gcc dot gnu.org> 2011-04-14 15:00:12 UTC ---
Author: jason
Date: Thu Apr 14 15:00:07 2011
New Revision: 172433

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=172433
Log:
    PR c++/48557
    * typeck.c (cp_build_binary_op): Don't decay void operands.

Added:
    trunk/gcc/testsuite/g++.dg/cpp0x/sfinae14.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/typeck.c
    trunk/gcc/testsuite/ChangeLog


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

* [Bug c++/48557] [C++0x][SFINAE] Hard errors with void as operand of binary built-in operators
  2011-04-11 18:04 [Bug c++/48557] New: [C++0x][SFINAE] Hard errors with void as operand of binary built-in operators daniel.kruegler at googlemail dot com
  2011-04-12  7:52 ` [Bug c++/48557] " daniel.kruegler at googlemail dot com
  2011-04-14 15:00 ` jason at gcc dot gnu.org
@ 2011-04-17  0:55 ` jason at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: jason at gcc dot gnu.org @ 2011-04-17  0:55 UTC (permalink / raw)
  To: gcc-bugs

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

Jason Merrill <jason at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
                 CC|                            |jason at gcc dot gnu.org
         Resolution|                            |FIXED
   Target Milestone|---                         |4.7.0

--- Comment #3 from Jason Merrill <jason at gcc dot gnu.org> 2011-04-17 00:55:17 UTC ---
Fixed for 4.7.


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

end of thread, other threads:[~2011-04-17  0:55 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-04-11 18:04 [Bug c++/48557] New: [C++0x][SFINAE] Hard errors with void as operand of binary built-in operators daniel.kruegler at googlemail dot com
2011-04-12  7:52 ` [Bug c++/48557] " daniel.kruegler at googlemail dot com
2011-04-14 15:00 ` jason at gcc dot gnu.org
2011-04-17  0:55 ` jason at gcc dot gnu.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).