+2012-08-25 Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR c++/51421
+ * decl2.c (mark_used): Consistently return false after errors
+ about uses before deduction of auto.
+ * semantics.c (finish_id_expression): Check mark_used return
+ value and return error_mark_node in case of failure.
+
2012-08-24 Jason Merrill <jason@redhat.com>
PR c++/51213 (again)
|| DECL_THUNK_P (decl))
{
if (!processing_template_decl && type_uses_auto (TREE_TYPE (decl)))
- error ("use of %qD before deduction of %<auto%>", decl);
+ {
+ error ("use of %qD before deduction of %<auto%>", decl);
+ return false;
+ }
return true;
}
}
if (type_uses_auto (TREE_TYPE (decl)))
- error ("use of %qD before deduction of %<auto%>", decl);
+ {
+ error ("use of %qD before deduction of %<auto%>", decl);
+ return false;
+ }
/* If we don't need a value, then we don't need to synthesize DECL. */
if (cp_unevaluated_operand != 0)
/* Mark variable-like entities as used. Functions are similarly
marked either below or after overload resolution. */
- if (TREE_CODE (decl) == VAR_DECL
- || TREE_CODE (decl) == PARM_DECL
- || TREE_CODE (decl) == CONST_DECL
- || TREE_CODE (decl) == RESULT_DECL)
- mark_used (decl);
+ if ((TREE_CODE (decl) == VAR_DECL
+ || TREE_CODE (decl) == PARM_DECL
+ || TREE_CODE (decl) == CONST_DECL
+ || TREE_CODE (decl) == RESULT_DECL)
+ && !mark_used (decl))
+ return error_mark_node;
/* Only certain kinds of names are allowed in constant
expression. Template parameters have already
+2012-08-25 Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR c++/51421
+ * g++.dg/cpp0x/auto34.C: New.
+
2012-08-24 Jakub Jelinek <jakub@redhat.com>
PR c/54363
--- /dev/null
+// PR c++/51421
+// { dg-do compile { target c++11 } }
+
+int foo1(int);
+
+void bar1()
+{
+ auto i = foo1(i); // { dg-error "before deduction" }
+}
+
+struct A {};
+
+A foo2(A);
+
+void bar2()
+{
+ auto a = foo2(a); // { dg-error "before deduction" }
+}