diff options
author | Jason Merrill <jason@redhat.com> | 2017-01-11 16:43:42 -0500 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2017-01-11 16:43:42 -0500 |
commit | 91d01bf40a7eec2f0eb5cbbbf9fee2399fa12b46 (patch) | |
tree | 82c146cb83c34e77c0591731d723d63ca785f116 /gcc/cp | |
parent | 73e32c4743fbd0d2c16ea2fb9212540707f3c01a (diff) | |
download | gcc-91d01bf40a7eec2f0eb5cbbbf9fee2399fa12b46.zip gcc-91d01bf40a7eec2f0eb5cbbbf9fee2399fa12b46.tar.gz gcc-91d01bf40a7eec2f0eb5cbbbf9fee2399fa12b46.tar.bz2 |
PR c++/78337 - ICE on invalid with generic lambda
* semantics.c (process_outer_var_ref): Check if containing_function
is null. Move inform call under complain test.
From-SVN: r244340
Diffstat (limited to 'gcc/cp')
-rw-r--r-- | gcc/cp/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/cp/semantics.c | 13 |
2 files changed, 15 insertions, 4 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index b318ab9..201d736 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2017-01-11 Jason Merrill <jason@redhat.com> + + PR c++/78337 - ICE on invalid with generic lambda + * semantics.c (process_outer_var_ref): Check if containing_function + is null. Move inform call under complain test. + 2017-01-11 Nathan Sidwell <nathan@acm.org> PR c++/77812 diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c index 342b671..4202475 100644 --- a/gcc/cp/semantics.c +++ b/gcc/cp/semantics.c @@ -3278,6 +3278,8 @@ process_outer_var_ref (tree decl, tsubst_flags_t complain) 2. a non-lambda function, or 3. a non-default capturing lambda function. */ while (context != containing_function + /* containing_function can be null with invalid generic lambdas. */ + && containing_function && LAMBDA_FUNCTION_P (containing_function)) { tree closure = DECL_CONTEXT (containing_function); @@ -3365,10 +3367,13 @@ process_outer_var_ref (tree decl, tsubst_flags_t complain) else { if (complain & tf_error) - error (VAR_P (decl) - ? G_("use of local variable with automatic storage from containing function") - : G_("use of parameter from containing function")); - inform (DECL_SOURCE_LOCATION (decl), "%q#D declared here", decl); + { + error (VAR_P (decl) + ? G_("use of local variable with automatic storage from " + "containing function") + : G_("use of parameter from containing function")); + inform (DECL_SOURCE_LOCATION (decl), "%q#D declared here", decl); + } return error_mark_node; } return decl; |