package pak1 is
   type T1 is new integer;
   type T1_access is access all T1;
   x1: aliased T1;
   x2: T1 := x1'access.all;                --ERROR: 4.1(8) (missed)
   x3: T1_access := T1_access(x1'access);  --ERROR: 4.6(6) (detected)
end pak1;


Gnat misses the error involving x1'access.all.
RM 3.10.2(2)/2 says "the expected type (for 'access) shall be
a single access type".  But ".all" doesn't provide a single
access type.  Instead, by RM 4.1(8), the name in a dereference
"is expected to be of any access type".

The rule for type_conversions (x3) is similar.  RM 4.6(6) says
"The operand of a type_conversion is expected to be of any type."
Gnat does detect this error.

$ gnatmake pak1
gcc-4.3 -c pak1.ads
pak1.ads:6:21: argument of conversion cannot be access
pak1.ads:6:21: use qualified expression instead
gnatmake: "pak1.ads" compilation error


-- 
           Summary: Illegal program accepted, RM 4.1(8), 8.6(27)/2
           Product: gcc
           Version: 4.3.4
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: ada
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: ludovic at ludovic-brenta dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42411

Reply via email to