aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/parser.c
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2021-08-25 15:10:21 -0400
committerJason Merrill <jason@redhat.com>2021-08-31 15:54:25 -0400
commit9c6344c10de1c90015c68adfb880291af980b886 (patch)
treee41045d74d9b32a9b9b9ec0ceaf53e025a79f157 /gcc/cp/parser.c
parente4cb3bb9ac11b4126ffa718287dd509a4b10a658 (diff)
downloadgcc-9c6344c10de1c90015c68adfb880291af980b886.zip
gcc-9c6344c10de1c90015c68adfb880291af980b886.tar.gz
gcc-9c6344c10de1c90015c68adfb880291af980b886.tar.bz2
c++: Various small fixes
A copy-paste error, a couple of missed checks to guard undefined accesses, and we don't need to use type_uses_auto to extract the auto node we just built. gcc/cp/ChangeLog: * coroutines.cc (flatten_await_stmt): Fix copyo. * decl.c (reshape_init_class): Simplify. * module.cc (module_state::read_language): Add null check. * parser.c (build_range_temp): Avoid type_uses_auto. (cp_parser_class_specifier_1): Add null check.
Diffstat (limited to 'gcc/cp/parser.c')
-rw-r--r--gcc/cp/parser.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index 1e2a4b1..d3c31be 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -13474,17 +13474,15 @@ cp_parser_range_for (cp_parser *parser, tree scope, tree init, tree range_decl,
static tree
build_range_temp (tree range_expr)
{
- tree range_type, range_temp;
-
/* Find out the type deduced by the declaration
`auto &&__range = range_expr'. */
- range_type = cp_build_reference_type (make_auto (), true);
- range_type = do_auto_deduction (range_type, range_expr,
- type_uses_auto (range_type));
+ tree auto_node = make_auto ();
+ tree range_type = cp_build_reference_type (auto_node, true);
+ range_type = do_auto_deduction (range_type, range_expr, auto_node);
/* Create the __range variable. */
- range_temp = build_decl (input_location, VAR_DECL, for_range__identifier,
- range_type);
+ tree range_temp = build_decl (input_location, VAR_DECL,
+ for_range__identifier, range_type);
TREE_USED (range_temp) = 1;
DECL_ARTIFICIAL (range_temp) = 1;
@@ -25910,7 +25908,8 @@ cp_parser_class_specifier_1 (cp_parser* parser)
so that maybe_instantiate_noexcept can tsubst the NOEXCEPT_EXPR
in the pattern. */
for (tree i : DEFPARSE_INSTANTIATIONS (def_parse))
- DEFERRED_NOEXCEPT_PATTERN (TREE_PURPOSE (i)) = TREE_PURPOSE (spec);
+ DEFERRED_NOEXCEPT_PATTERN (TREE_PURPOSE (i))
+ = spec ? TREE_PURPOSE (spec) : error_mark_node;
/* Restore the state of local_variables_forbidden_p. */
parser->local_variables_forbidden_p = local_variables_forbidden_p;