diff options
author | Paolo Carlini <paolo.carlini@oracle.com> | 2017-12-13 20:29:11 +0000 |
---|---|---|
committer | Paolo Carlini <paolo@gcc.gnu.org> | 2017-12-13 20:29:11 +0000 |
commit | ae51fb47811a9d5a3cfbb67677dae0eababc263d (patch) | |
tree | 9b90ea22696cd42a9a266ff8ccd88a7ec0606cf6 /gcc | |
parent | 5ef54d5722c86095bafaf6d83ecdac38db1bce52 (diff) | |
download | gcc-ae51fb47811a9d5a3cfbb67677dae0eababc263d.zip gcc-ae51fb47811a9d5a3cfbb67677dae0eababc263d.tar.gz gcc-ae51fb47811a9d5a3cfbb67677dae0eababc263d.tar.bz2 |
re PR c++/81061 (ICE modifying read-only variable)
/cp
2017-12-13 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/81061
* typeck.c (cp_build_modify_expr): Upon cxx_readonly_error
immediately return error_mark_node.
/testsuite
2017-12-13 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/81061
* g++.dg/other/const5.C: New.
From-SVN: r255613
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/cp/typeck.c | 3 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/other/const5.C | 8 |
4 files changed, 20 insertions, 2 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index d298315..d362c47 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2017-12-13 Paolo Carlini <paolo.carlini@oracle.com> + + PR c++/81061 + * typeck.c (cp_build_modify_expr): Upon cxx_readonly_error + immediately return error_mark_node. + 2017-12-13 Nathan Sidwell <nathan@acm.org> PR c++/15272 diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c index 7210f99..8f3302f 100644 --- a/gcc/cp/typeck.c +++ b/gcc/cp/typeck.c @@ -8037,8 +8037,7 @@ cp_build_modify_expr (location_t loc, tree lhs, enum tree_code modifycode, { if (complain & tf_error) cxx_readonly_error (lhs, lv_assign); - else - return error_mark_node; + return error_mark_node; } /* If storing into a structure or union member, it may have been given a diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 43ef569..5a3d8f2 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2017-12-13 Paolo Carlini <paolo.carlini@oracle.com> + + PR c++/81061 + * g++.dg/other/const5.C: New. + 2017-12-13 Alexandre Oliva <aoliva@redhat.com> Jakub Jelinek <jakub@redhat.com> diff --git a/gcc/testsuite/g++.dg/other/const5.C b/gcc/testsuite/g++.dg/other/const5.C new file mode 100644 index 0000000..fabe361 --- /dev/null +++ b/gcc/testsuite/g++.dg/other/const5.C @@ -0,0 +1,8 @@ +// PR c++/81061 + +const int i = 0; + +void foo() +{ + (0, i) = 1; // { dg-error "read-only" } +} |