@@ -18926,7 +18926,11 @@ do_auto_deduction (tree type, tree init, tree auto_node)
DEDUCE_CALL, LOOKUP_NORMAL);
if (val > 0)
{
- error ("unable to deduce %qT from %qE", type, init);
+ if (type && type != error_mark_node)
+ /* If type is error_mark_node a diagnostic must have been
+ emitted by now. Also, having a mention to '<type error>'
+ in the diagnostic is not really useful to the user. */
+ error ("unable to deduce %qT from %qE", type, init);
return error_mark_node;
}
@@ -3148,7 +3148,8 @@ finish_id_expression (tree id_expression,
/* Only certain kinds of names are allowed in constant
expression. Enumerators and template parameters have already
been handled above. */
- if (integral_constant_expression_p
+ if (! error_operand_p (decl)
+ && integral_constant_expression_p
&& ! decl_constant_var_p (decl)
&& ! builtin_valid_in_constant_expr_p (decl))
{
new file mode 100644
@@ -0,0 +1,5 @@
+// Origin PR c++/47208
+// { dg-options "-std=c++0x" }
+
+constexpr auto list = { }; // { dg-error "deducing from brace-enclosed initializer list requires #include <initializer_list>" }
+static const int l = list.size();