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.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: a07f3367d7,1be082612b8c5f2e,start X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news1.google.com!npeer03.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!post01.iad.highwinds-media.com!API-DIGITAL.COM-a2kHrUvQQWlmc!not-for-mail Date: Sat, 29 May 2010 12:36:33 -0500 From: "Marc A. Criley" User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.9) Gecko/20100423 Thunderbird/3.0.4 MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Dynamically tagged expression not allowed. Why? Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Message-ID: X-Complaints-To: abuse@usenetserver.com Organization: UseNetServer.com X-Trace: c2ead4c0150a0e9010d8611809 Xref: g2news2.google.com comp.lang.ada:12147 Date: 2010-05-29T12:36:33-05:00 List-Id: I'm creating a GNAT 4.4.3 on Ubuntu Ada binding for some C++ classes, using the binding generated by g++ -fdump-ada-spec as a starting point. While the binding will compile cleanly, the client code gets a compilation error, "dynamically tagged expression not allowed", when trying to set up the declarations to utilize it. Stripping out a test case, I see that it has nothing to with the C++ binding per se, but it's an Ada issue that's flummoxing me. Here's the test code: procedure Dyty_Test is type Class_Type is tagged limited record null; end record; function New_Class_Instance return Class_Type'Class; Conn : Class_Type := New_Class_Instance; function New_Class_Instance return Class_Type'Class is begin -- Just a stub return New_Class_Instance; end New_Class_Instance; begin null; end Dyty_Test; The Class_Type definition MUST be a tagged limited record to correspond to the C++ class, and the New_Class_Instance function (the constructor) MUST return a class-wide instance of that type. (There are corresponding C++ pragmas as well for these, but the error is the same whether they're present or not.) The error is on the declaration of "Conn", with the error occurring on the invocation of the initializing New_Class_Instance function. I'm just not understanding something here. I've tried a number of variations, but these have more or less become guesswork, and so it's time to ask for help :-) Thanks. Marc A. Criley McKae Technologies www.mckae.com