[Ada] Illegal copy of limited object
authorEd Schonberg <schonberg@adacore.com>
Thu, 31 May 2018 10:47:03 +0000 (10:47 +0000)
committerPierre-Marie de Rodat <pmderodat@gcc.gnu.org>
Thu, 31 May 2018 10:47:03 +0000 (10:47 +0000)
commit6ae40af30c0d2db1fe3d9610ade37004ee0c1d38
tree28d48163113af5be6ce2267c4849a6b183819ed1
parentc9f357688263239dee41cef4762f0ad78c1bb442
[Ada] Illegal copy of limited object

This patch fixes a spurious copy of a limited object, when that object
is a discriminated record component of a limited type LT, and the enclosing
record is initialized by means of an aggregate, one of whose components is a
call to a build-in-place function that returns an unconstrained object of
type T.

2018-05-31  Ed Schonberg  <schonberg@adacore.com>

gcc/ada/

* checks.adb (Apply_Discriminant_Check): Do not apply discriminant
check to a call to a build-in-place function, given that the return
object is limited and cannot be copied.

gcc/testsuite/

* gnat.dg/limited1.adb, gnat.dg/limited1_inner.adb,
gnat.dg/limited1_inner.ads, gnat.dg/limited1_outer.adb,
gnat.dg/limited1_outer.ads: New testcase.

From-SVN: r261009
gcc/ada/ChangeLog
gcc/ada/checks.adb
gcc/testsuite/ChangeLog
gcc/testsuite/gnat.dg/limited1.adb [new file with mode: 0644]
gcc/testsuite/gnat.dg/limited1_inner.adb [new file with mode: 0644]
gcc/testsuite/gnat.dg/limited1_inner.ads [new file with mode: 0644]
gcc/testsuite/gnat.dg/limited1_outer.adb [new file with mode: 0644]
gcc/testsuite/gnat.dg/limited1_outer.ads [new file with mode: 0644]