comp.lang.ada
 help / color / mirror / Atom feed
* Ambiguous character literals
@ 1999-04-24  0:00 adam
  1999-04-26  0:00 ` Tucker Taft
  1999-04-28  0:00 ` Robert Dewar
  0 siblings, 2 replies; 3+ messages in thread
From: adam @ 1999-04-24  0:00 UTC (permalink / raw)





I think this program should fail to compile, but GNAT 3.10 doesn't give
any error messages.  Am I interpreting the RM correctly?  Or is there
some nuance I'm missing in the RM that causes STANDARD.CHARACTER to be
preferred in a case like this?

Also, I think the program should still be illegal if one or both of the
enumeration type declarations is deleted (since "<" is still visible for
CHARACTER and WIDE_CHARACTER).  Is my understanding correct?

				-- thanks, Adam

procedure test is
    type etype is ('d', 'c', 'b', 'a');
    type etype2 is ('a', 'b', 'c', 'd');
    b : boolean;
begin
    b := ('d' < 'b');
end test;

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    




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

* Re: Ambiguous character literals
  1999-04-24  0:00 Ambiguous character literals adam
@ 1999-04-26  0:00 ` Tucker Taft
  1999-04-28  0:00 ` Robert Dewar
  1 sibling, 0 replies; 3+ messages in thread
From: Tucker Taft @ 1999-04-26  0:00 UTC (permalink / raw)


adam@irvine.com wrote:
> 
> I think this program should fail to compile, but GNAT 3.10 doesn't give
> any error messages.  Am I interpreting the RM correctly?  Or is there
> some nuance I'm missing in the RM that causes STANDARD.CHARACTER to be
> preferred in a case like this?
> 
> Also, I think the program should still be illegal if one or both of the
> enumeration type declarations is deleted (since "<" is still visible for
> CHARACTER and WIDE_CHARACTER).  Is my understanding correct?

Your understanding is correct.  It seems that your version
of GNAT is being a bit too friendly.

Here is the error message our compiler gives:

    6     b := ('d' < 'b');
                    *
*****Error: The expression is ambiguous, Continuing
 
> 
>                                 -- thanks, Adam
> 
> procedure test is
>     type etype is ('d', 'c', 'b', 'a');
>     type etype2 is ('a', 'b', 'c', 'd');
>     b : boolean;
> begin
>     b := ('d' < 'b');
> end test;

-- 
-Tucker Taft   stt@averstar.com   http://www.averstar.com/~stt/
Technical Director, Distributed IT Solutions  (www.averstar.com/tools)
AverStar (formerly Intermetrics, Inc.)   Burlington, MA  USA




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

* Re: Ambiguous character literals
  1999-04-24  0:00 Ambiguous character literals adam
  1999-04-26  0:00 ` Tucker Taft
@ 1999-04-28  0:00 ` Robert Dewar
  1 sibling, 0 replies; 3+ messages in thread
From: Robert Dewar @ 1999-04-28  0:00 UTC (permalink / raw)


In article <7fr2hr$sak$1@nnrp1.dejanews.com>,
  adam@irvine.com wrote:
>
>
> I think this program should fail to compile, but GNAT
> 3.10 doesn't give any error messages.  Am I interpreting
> the RM correctly?

Yes, you are, and both 3.10 and 3.11 versions of GNAT
incorrectly allow this construction. Version 3.12 (which
we hope to release shortly), will give:
     1. procedure test1 is
     2.     type etype is ('d', 'c', 'b', 'a');
     3.     type etype2 is ('a', 'b', 'c', 'd');
     4.     b : boolean;
     5. begin
     6.     b := ('d' < 'b');
                  |
        >>> ambiguous character literal
        >>> candidate interpretations: Character,
                                       Wide_Character
        >>> candidate interpretation: type "etype2" defined
                                      at line 3
        >>> candidate interpretation: type "etype" defined
                                      at line 2

     7. end test1;

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    




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

end of thread, other threads:[~1999-04-28  0:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-04-24  0:00 Ambiguous character literals adam
1999-04-26  0:00 ` Tucker Taft
1999-04-28  0:00 ` Robert Dewar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox