Commit a66e8081 by Jason Merrill Committed by Jason Merrill

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
parent fe5b5c36
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);
}
......
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>
......
// 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)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment