mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-04-11 13:01:20 +08:00
re PR c++/48557 ([C++0x][SFINAE] Hard errors with void as operand of binary built-in operators)
PR c++/48557 * typeck.c (cp_build_binary_op): Don't decay void operands. From-SVN: r172433
This commit is contained in:
parent
fe5b5c364b
commit
a66e8081b5
@ -1,5 +1,8 @@
|
||||
2011-04-14 Jason Merrill <jason@redhat.com>
|
||||
|
||||
PR c++/48557
|
||||
* typeck.c (cp_build_binary_op): Don't decay void operands.
|
||||
|
||||
PR c++/48446
|
||||
* decl.c (compute_array_index_type): Use get_temp_regvar instead
|
||||
of variable_size.
|
||||
|
@ -3646,16 +3646,16 @@ cp_build_binary_op (location_t location,
|
||||
|| code == TRUTH_OR_EXPR || code == TRUTH_ORIF_EXPR
|
||||
|| code == TRUTH_XOR_EXPR)
|
||||
{
|
||||
if (!really_overloaded_fn (op0))
|
||||
if (!really_overloaded_fn (op0) && !VOID_TYPE_P (TREE_TYPE (op0)))
|
||||
op0 = decay_conversion (op0);
|
||||
if (!really_overloaded_fn (op1))
|
||||
if (!really_overloaded_fn (op1) && !VOID_TYPE_P (TREE_TYPE (op1)))
|
||||
op1 = decay_conversion (op1);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!really_overloaded_fn (op0))
|
||||
if (!really_overloaded_fn (op0) && !VOID_TYPE_P (TREE_TYPE (op0)))
|
||||
op0 = default_conversion (op0);
|
||||
if (!really_overloaded_fn (op1))
|
||||
if (!really_overloaded_fn (op1) && !VOID_TYPE_P (TREE_TYPE (op1)))
|
||||
op1 = default_conversion (op1);
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,7 @@
|
||||
2011-04-14 Jason Merrill <jason@redhat.com>
|
||||
|
||||
* g++.dg/cpp0x/sfinae14.C: New.
|
||||
|
||||
* g++.dg/ext/vla10.C: New.
|
||||
|
||||
2011-04-14 Richard Guenther <rguenther@suse.de>
|
||||
|
27
gcc/testsuite/g++.dg/cpp0x/sfinae14.C
Normal file
27
gcc/testsuite/g++.dg/cpp0x/sfinae14.C
Normal file
@ -0,0 +1,27 @@
|
||||
// PR c++/48557
|
||||
// { dg-options -std=c++0x }
|
||||
|
||||
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)
|
Loading…
x
Reference in New Issue
Block a user