c++: Invisible refs are not restrict [PR97474]
authorJason Merrill <jason@redhat.com>
Tue, 26 Jan 2021 21:04:24 +0000 (16:04 -0500)
committerJason Merrill <jason@redhat.com>
Tue, 26 Jan 2021 22:10:58 +0000 (17:10 -0500)
commit96253f069ead0736536de803b06a8053a85039a6
tree86ffdaf30dbb91f5a29cb8b38abf83d07e53970f
parenta4dfd0f089af33f2af57bf422f9859405b9b4a16
c++: Invisible refs are not restrict [PR97474]

In this testcase, we refer to the a parameter through a reference in its own
member, which we asserted couldn't happen by marking the parameter as
'restrict'.  This assumption could also be broken if the address escapes
from the constructor.

gcc/cp/ChangeLog:

PR c++/97474
* call.c (type_passed_as): Don't mark invisiref restrict.

gcc/testsuite/ChangeLog:

PR c++/97474
* g++.dg/torture/pr97474.C: New test.
gcc/cp/call.c
gcc/testsuite/g++.dg/torture/pr97474.C [new file with mode: 0644]