From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID, LOTS_OF_MONEY autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,e3c7ee8cd1d3f414 X-Google-Attributes: gid103376,public From: bobduff@world.std.com (Robert A Duff) Subject: Re: rep clause in generics Date: 1997/03/14 Message-ID: #1/1 X-Deja-AN: 225489862 References: <01bc3057$61a78db0$81946482@vkpc131> Organization: The World Public Access UNIX, Brookline, MA Newsgroups: comp.lang.ada Date: 1997-03-14T00:00:00+00:00 List-Id: In article <01bc3057$61a78db0$81946482@vkpc131>, Jonas Nygren wrote: >The compiler complained with: > > gen_buffers.ads:9:39: static integer expression required here > >I thought that Element_Type'Size was a static integer expression. Am I or >the compiler in error? You are in error. S'Size is static only if S is a static scalar subtype. Element_Size is neither scalar nor static. (Generic formal subtypes are never static.) See 4.9. It's sad that you can't do this, I admit. But allowing it would be complicated -- generic contract model problems rear their ugly heads. (As a compiler writer, I find it annoying that 'Size is *ever* static -- it messes up one's compiler design. You'd like to say 'Size is a machine-dependent thing, and relegate it to the back end, or some such late, machine-dependent, phase. Unfortunately, its value is needed during overload resolution: e.g., P(Some_Array'First(S'Size mod 2)); Which P is called depends on the static value of S'Size! ) - Bob