comp.lang.ada
 help / color / mirror / Atom feed
* Infinite recursion in Static_Predicate ?
@ 2013-07-22 18:17 Yannick Duchêne (Hibou57)
  2013-07-22 19:09 ` Anh Vo
  0 siblings, 1 reply; 3+ messages in thread
From: Yannick Duchêne (Hibou57) @ 2013-07-22 18:17 UTC (permalink / raw)


Hi people,

Can't guess what I'm doing wrong. I wanted to defined a scalar type from  
another, with fine restriction than the classic sub‑range. That's one of  
the things static predicates are for.

Checking if it's me or the compiler, I just tried this tiny samples from
http://ada-dk.org/2013/04/superbtypes-in-ada-2012-part-1/
and get the same error with this sample.

Sample:

     type Day is
       (Monday, Tuesday, Wednesday,
        Thursday, Friday, Saturday, Sunday);

     type T_Day
        is new Day
           with Static_Predicate =>
              T_Day in Tuesday | Thursday;

Error:

     warning: attribute Valid requires a predicate check
     warning: and will result in infinite recursion
     expression does not have required form for static predicate
     i386-linux-gnu-gnatmake: compilation error

Is this a compiler bug or some subtle changes in the RM I'm not aware of?  
(and neither the author of ada-dk.org)


-- 
“Syntactic sugar causes cancer of the semi-colons.” [1]
“Structured Programming supports the law of the excluded muddle.” [1]
[1]: Epigrams on Programming — Alan J. — P. Yale University

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

* Re: Infinite recursion in Static_Predicate ?
  2013-07-22 18:17 Infinite recursion in Static_Predicate ? Yannick Duchêne (Hibou57)
@ 2013-07-22 19:09 ` Anh Vo
  2013-07-22 20:09   ` Bill Findlay
  0 siblings, 1 reply; 3+ messages in thread
From: Anh Vo @ 2013-07-22 19:09 UTC (permalink / raw)


On Monday, July 22, 2013 11:17:52 AM UTC-7, Hibou57 (Yannick Duchêne) wrote:
> Hi people,
>  
>      type Day is
> 
>        (Monday, Tuesday, Wednesday,
> 
>         Thursday, Friday, Saturday, Sunday);
> 
> 
> 
>      type T_Day
> 
>         is new Day
> 
>            with Static_Predicate =>
> 
>               T_Day in Tuesday | Thursday;

It compiles fine with GNAT-GPL-2013 on Windows. 

A. Vo

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

* Re: Infinite recursion in Static_Predicate ?
  2013-07-22 19:09 ` Anh Vo
@ 2013-07-22 20:09   ` Bill Findlay
  0 siblings, 0 replies; 3+ messages in thread
From: Bill Findlay @ 2013-07-22 20:09 UTC (permalink / raw)


On 22/07/2013 20:09, in article
8b75330e-0733-4ca3-83a7-8f6b1b9916e4@googlegroups.com, "Anh Vo"
<anhvofrcaus@gmail.com> wrote:

> On Monday, July 22, 2013 11:17:52 AM UTC-7, Hibou57 (Yannick Duchêne) wrote:
>> Hi people,
>>  
>>      type Day is
>> 
>>        (Monday, Tuesday, Wednesday,
>> 
>>         Thursday, Friday, Saturday, Sunday);
>> 
>> 
>> 
>>      type T_Day
>> 
>>         is new Day
>> 
>>            with Static_Predicate =>
>> 
>>               T_Day in Tuesday | Thursday;
> 
> It compiles fine with GNAT-GPL-2013 on Windows.


OK wih GNAT GPL 2013 on OS X as well.

-- 
Bill Findlay
with blueyonder.co.uk;
use  surname & forename;


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

end of thread, other threads:[~2013-07-22 20:09 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-07-22 18:17 Infinite recursion in Static_Predicate ? Yannick Duchêne (Hibou57)
2013-07-22 19:09 ` Anh Vo
2013-07-22 20:09   ` Bill Findlay

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