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.
|| 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>
--- /dev/null
+// 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)