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 autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,d6c75b0f89a0f085,start X-Google-Attributes: gid103376,public From: okellogg@my-dejanews.com Subject: What's wrong with this code? Date: 1999/04/20 Message-ID: <7fi85m$sb3$1@nnrp1.dejanews.com>#1/1 X-Deja-AN: 468729089 X-Http-Proxy: 1.0 x9.dejanews.com:80 (Squid/1.1.22) for client 195.243.118.226 Organization: Deja News - The Leader in Internet Discussion X-Article-Creation-Date: Tue Apr 20 15:57:45 1999 GMT Newsgroups: comp.lang.ada X-Http-User-Agent: Mozilla/2.0 (compatible; MSIE 3.01; Windows NT) Date: 1999-04-20T00:00:00+00:00 List-Id: Dear colleagues: I can't find what wrong with this code (see full declaration of type Alarm.) Perhaps someone would like to comment? Thanks alot, Oliver Kellogg DaimlerChrysler Aerospace Sensor Systems, Dept. VGE15 D-89070 Ulm, Germany e-mail: oliver.kellogg@vs.dasa.de -- -- file: alarm_model.ads package Alarm_Model is type Alarm is tagged limited private; type Alarm_P is access all Alarm'Class; procedure Norm (This : access Alarm'Class); private type Alarm_State_Et is (Snafu, Data, Proposal); type Alarm_State (My_Alarm : access Alarm) is abstract tagged limited null record; type Alarm_State_P is access all Alarm_State'Class; type Alarm_State_Pool_At is array (Alarm_State_Et) of Alarm_State_P; procedure Enter (This : access Alarm_State); type Snafu_State is new Alarm_State with null record; type Snafu_State_P is access all Snafu_State'Class; procedure Request_Data (This : access Snafu_State); type Data_State is new Alarm_State with null record; type Data_State_P is access all Data_State'Class; type Proposal_State is new Alarm_State with null record; type Proposal_State_P is access all Proposal_State'Class; protected type Alarm_Semaphore (My_Alarm : access Alarm) is function Get return Alarm_State_P; procedure Set (New_State : in Alarm_State_Et); private Current_State : Alarm_State_Et := Snafu; ----------------------------- This is the workaround used -- Alarm_State_Pool : Alarm_State_Pool_At := -- (Snafu => new Snafu_State (My_Alarm), -- Data => new Data_State (My_Alarm), -- Proposal => new Proposal_State (My_Alarm)); end Alarm_Semaphore; type Alarm is tagged limited record -- This compiles alright: Semaphore : Alarm_Semaphore (Alarm'Access); -- But here, GNAT 3.11p says: -- "Access" attribute cannot be applied to type Alarm_State_Pool : Alarm_State_Pool_At := (Snafu => new Snafu_State (Alarm'Access), Data => new Data_State (Alarm'Access), Proposal => new Proposal_State (Alarm'Access)); end record; end Alarm_Model; -----------== Posted via Deja News, The Discussion Network ==---------- http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own