summaryrefslogtreecommitdiff
path: root/gcc/cp/pt.c
diff options
context:
space:
mode:
authorjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>2015-12-07 04:34:43 +0000
committerjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>2015-12-07 04:34:43 +0000
commitb34f7e66cb96f137d5283d6285ffa1d333756e52 (patch)
tree3301952703831d6af8b321a802640f7212d328df /gcc/cp/pt.c
parentb15717524a33180c09ee223a06402c92d436df77 (diff)
downloadgcc-b34f7e66cb96f137d5283d6285ffa1d333756e52.tar.gz
PR c++/68597, fix auto9.C and auto-neg1.C with -std=c++1z.
* decl.c (check_tag_decl): Use ds_type_spec in auto diagnostic. * typeck.c (check_return_expr): Check for inconsistent deduction. * parser.c (class type_id_in_expr_sentinel): New. (cp_parser_primary_expression) [RID_VA_ARG]: Use it. (cp_parser_new_expression): Use it. (cp_parser_trait_expr): Use it. (cp_parser_type_id_1): Complain about auto if in_type_id_in_expr_p. (cp_parser_default_type_template_argument): Check for auto. (cp_parser_type_id_list): Likewise. (cp_parser_simple_type_specifier): Allow auto parms if flag_concepts. * pt.c (do_auto_deduction): Handle erroneous type. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@231349 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cp/pt.c')
-rw-r--r--gcc/cp/pt.c27
1 files changed, 6 insertions, 21 deletions
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index 8435ddc224a..6e50fcd1ee9 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -23712,6 +23712,9 @@ do_auto_deduction (tree type, tree init, tree auto_node,
}
}
+ if (type == error_mark_node)
+ return error_mark_node;
+
init = resolve_nondeduced_context (init);
if (AUTO_IS_DECLTYPE (auto_node))
@@ -23770,26 +23773,6 @@ do_auto_deduction (tree type, tree init, tree auto_node,
}
}
- /* If the list of declarators contains more than one declarator, the type
- of each declared variable is determined as described above. If the
- type deduced for the template parameter U is not the same in each
- deduction, the program is ill-formed. */
- if (!flag_concepts && TREE_TYPE (auto_node)
- && !same_type_p (TREE_TYPE (auto_node), TREE_VEC_ELT (targs, 0)))
- {
- if (cfun && auto_node == current_function_auto_return_pattern
- && LAMBDA_FUNCTION_P (current_function_decl))
- error ("inconsistent types %qT and %qT deduced for "
- "lambda return type", TREE_TYPE (auto_node),
- TREE_VEC_ELT (targs, 0));
- else
- error ("inconsistent deduction for %qT: %qT and then %qT",
- auto_node, TREE_TYPE (auto_node), TREE_VEC_ELT (targs, 0));
- return error_mark_node;
- }
- if (!flag_concepts)
- TREE_TYPE (auto_node) = TREE_VEC_ELT (targs, 0);
-
/* Check any placeholder constraints against the deduced type. */
if (flag_concepts && !processing_template_decl)
if (tree constr = PLACEHOLDER_TYPE_CONSTRAINTS (auto_node))
@@ -23877,7 +23860,9 @@ is_auto_r (tree tp, void */*data*/)
tree
type_uses_auto (tree type)
{
- if (flag_concepts)
+ if (type == NULL_TREE)
+ return NULL_TREE;
+ else if (flag_concepts)
{
/* The Concepts TS allows multiple autos in one type-specifier; just
return the first one we find, do_auto_deduction will collect all of