2010-09-06 Jason Merrill <jason@redhat.com>
+ * call.c (implicit_conversion): Fix value-init of enums.
+ (convert_like_real): Likewise.
+
* decl.c (cp_finish_decl): Don't change init for auto deduction.
* pt.c (fold_non_dependent_expr_sfinae): Split out from...
tree elt;
if (nelts == 0)
- elt = integer_zero_node;
+ elt = build_value_init (to, tf_none);
else if (nelts == 1)
elt = CONSTRUCTOR_ELT (expr, 0)->value;
else
{
int nelts = CONSTRUCTOR_NELTS (expr);
if (nelts == 0)
- expr = integer_zero_node;
+ expr = build_value_init (totype, tf_warning_or_error);
else if (nelts == 1)
expr = CONSTRUCTOR_ELT (expr, 0)->value;
else
2010-09-06 Jason Merrill <jason@redhat.com>
+ * g++.dg/cpp0x/initlist42.C: New.
+
* g++.dg/cpp0x/auto19.C: New.
* g++.dg/template/sfinae25.C: New.
--- /dev/null
+// { dg-options -std=c++0x }
+
+enum Unscoped { };
+enum class Scoped { };
+
+Unscoped bar(Unscoped x) { return x; }
+Scoped bar(Scoped x) { return x; }
+
+auto var1u = bar(Unscoped()); // OK
+auto var1s = bar(Scoped()); // OK
+
+auto var2u = bar(Unscoped{}); // #1 Error, but should work
+auto var2s = bar(Scoped{}); // #2 Error, but should work