This patch fixes the spurious error regarding assignment to limited types.
Inside record initialization, the assignment calling a constructor is actually
its initialization, and is considered legal.
gcc/ada/ChangeLog:
* sem_ch5.adb: Skip check for assignment that doesn't come from source.
-- Error of assigning to limited type. We do however allow this in
-- certain cases where the front end generates the assignments.
-- Comes_From_Source test is needed to allow compiler-generated
- -- streaming/put_image subprograms, which may ignore privacy.
+ -- constructor calls or streaming/put_image subprograms, which may
+ -- ignore privacy.
elsif Is_Limited_Type (T1)
and then not Assignment_OK (Lhs)
and then not Assignment_OK (Original_Node (Lhs))
- and then (Comes_From_Source (N) or Is_Immutably_Limited_Type (T1))
+ and then Comes_From_Source (N)
then
-- CPP constructors can only be called in declarations