aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
authorPaolo Carlini <paolo.carlini@oracle.com>2012-08-25 09:53:30 +0000
committerPaolo Carlini <paolo@gcc.gnu.org>2012-08-25 09:53:30 +0000
commitf27a59cf8a51f4c28cec55545673405b20a02a98 (patch)
tree2800260d9c8b267b986fcfd7872938067b8bd713 /gcc/cp
parentcd057e3af0627c7528c19625bf972acde2b207fa (diff)
downloadgcc-f27a59cf8a51f4c28cec55545673405b20a02a98.zip
gcc-f27a59cf8a51f4c28cec55545673405b20a02a98.tar.gz
gcc-f27a59cf8a51f4c28cec55545673405b20a02a98.tar.bz2
re PR c++/51421 ([c++0x] ICE with invalid use of auto)
/cp 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. /testsuite 2012-08-25 Paolo Carlini <paolo.carlini@oracle.com> PR c++/51421 * g++.dg/cpp0x/auto34.C: New. From-SVN: r190665
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/ChangeLog8
-rw-r--r--gcc/cp/decl2.c10
-rw-r--r--gcc/cp/semantics.c11
3 files changed, 22 insertions, 7 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 4cad303..845f0b4 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,11 @@
+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)
diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c
index 281f6ff..f76b596 100644
--- a/gcc/cp/decl2.c
+++ b/gcc/cp/decl2.c
@@ -4238,7 +4238,10 @@ mark_used (tree decl)
|| 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;
}
@@ -4284,7 +4287,10 @@ mark_used (tree decl)
}
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)
diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c
index 4faca91..d66accf 100644
--- a/gcc/cp/semantics.c
+++ b/gcc/cp/semantics.c
@@ -3221,11 +3221,12 @@ finish_id_expression (tree id_expression,
/* 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