comp.lang.ada
 help / color / mirror / Atom feed
From: "Marc A. Criley" <mcNOSPAM@mckae.com>
Subject: Dynamically tagged expression not allowed. Why?
Date: Sat, 29 May 2010 12:36:33 -0500
Date: 2010-05-29T12:36:33-05:00	[thread overview]
Message-ID: <c2ead$4c0150a0$4ca4a823$11809@API-DIGITAL.COM> (raw)

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



             reply	other threads:[~2010-05-29 17:36 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-29 17:36 Marc A. Criley [this message]
2010-05-29 18:23 ` Dynamically tagged expression not allowed. Why? Dmitry A. Kazakov
2010-06-03  2:37   ` Yannick Duchêne (Hibou57)
2010-06-03  7:48     ` Dmitry A. Kazakov
2010-06-01 23:36 ` Randy Brukardt
2010-06-03  2:36   ` Yannick Duchêne (Hibou57)
2010-06-03  7:57     ` Dmitry A. Kazakov
2010-06-03  8:21       ` Yannick Duchêne (Hibou57)
2010-06-03 16:03     ` Adam Beneschan
2010-06-05 18:47   ` Marc A. Criley
replies disabled

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