public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug ada/23208] New: Illegal program not detected, RM 12.5.1(15, 28)
@ 2005-08-02 20:45 ludovic dot brenta at insalien dot org
  2005-08-02 20:46 ` [Bug ada/23208] " ludovic dot brenta at insalien dot org
  2005-08-03  5:14 ` ludovic dot brenta at insalien dot org
  0 siblings, 2 replies; 3+ messages in thread
From: ludovic dot brenta at insalien dot org @ 2005-08-02 20:45 UTC (permalink / raw)
  To: gcc-bugs

procedure Test_12_5_1 is
   generic
      type T is private; -- should be type T (<>) is private;
   package P is
   end P;

   type R (B : Boolean := True) is record
      case B is
         when True => Component : Integer;
         when False => null;
      end case;
   end record;

   package PP is new P (T => R); -- line 14
begin
   null;
end Test_12_5_1;

In Ada 95, indefinite types no longer match generic formal types that don't have
a discriminant_part.

Expected output is along the lines of:
test_12_5_1.adb:14:29: actual type cannot be indefinite
test_12_5_1.adb:14:29: consider adding (<>) to the formal type declaration

The compiler says nothing.

Am I mistaken in believing that the type R is indefinite?

-- 
           Summary: Illegal program not detected, RM 12.5.1(15, 28)
           Product: gcc
           Version: 4.0.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: ada
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: ludovic dot brenta at insalien dot org
                CC: gcc-bugs at gcc dot gnu dot org


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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug ada/23208] Illegal program not detected, RM 12.5.1(15, 28)
  2005-08-02 20:45 [Bug ada/23208] New: Illegal program not detected, RM 12.5.1(15, 28) ludovic dot brenta at insalien dot org
@ 2005-08-02 20:46 ` ludovic dot brenta at insalien dot org
  2005-08-03  5:14 ` ludovic dot brenta at insalien dot org
  1 sibling, 0 replies; 3+ messages in thread
From: ludovic dot brenta at insalien dot org @ 2005-08-02 20:46 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |accepts-invalid


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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug ada/23208] Illegal program not detected, RM 12.5.1(15, 28)
  2005-08-02 20:45 [Bug ada/23208] New: Illegal program not detected, RM 12.5.1(15, 28) ludovic dot brenta at insalien dot org
  2005-08-02 20:46 ` [Bug ada/23208] " ludovic dot brenta at insalien dot org
@ 2005-08-03  5:14 ` ludovic dot brenta at insalien dot org
  1 sibling, 0 replies; 3+ messages in thread
From: ludovic dot brenta at insalien dot org @ 2005-08-03  5:14 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From ludovic dot brenta at insalien dot org  2005-08-03 05:14 -------
Yes, I was mistaken: RM 3.3(23) says: "A subtype is an indefinite subtype if it
is an unconstrained array subtype, or if it has unknown discriminants or
unconstrained discriminants without defaults, otherwise the subtype is a
definite subtype".  Therefore, R is a definite subtype since it has known
discriminants.  In contrast:

procedure Test_12_5_1 is
   generic
      type T is private;
   package P is
   end P;

   package Q is
      type R (<>) is private;
   private
      type R (B : Boolean := True) is record
         case B is
            when True => Component : Integer;
            when False => null;
         end case;
      end record;
   end Q;

   package PP is new P (T => Q.R);
begin
   null;
end Test_12_5_1;


Here, Q.R is indefinite and GNAT correcly diagnoses the problem:

test_12_5_1.adb:18:31: actual for "T" must be a definite subtype
gnatmake: "test_12_5_1.adb" compilation error

Marking this bug as INVALID (i.e. not a bug).

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID


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


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2005-08-03  5:14 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-08-02 20:45 [Bug ada/23208] New: Illegal program not detected, RM 12.5.1(15, 28) ludovic dot brenta at insalien dot org
2005-08-02 20:46 ` [Bug ada/23208] " ludovic dot brenta at insalien dot org
2005-08-03  5:14 ` ludovic dot brenta at insalien dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).