grasph / wrapit

Automatization of C++--Julia wrapper generation
MIT License
98 stars 12 forks source link

Types[defs] defined with using do not work #37

Closed peremato closed 7 months ago

peremato commented 7 months ago

The following class

class G4VMPLData
{
  public:
    using G4PhysConstVectorData = std::vector<G4VPhysicsConstructor*>;
    void initialize() { physicsVector = new G4PhysConstVectorData; }
    G4PhysConstVectorData* physicsVector = nullptr;
};

generates accessors for physicsVector that fail compilation:

libTestUsingType/src/jlTestUsingType.cxx:67:58: error: unknown type name 'G4PhysConstVectorData'; did you mean 'G4VMPLData::G4PhysConstVectorData'?
    t.method("physicsVector", [](const G4VMPLData& a) -> G4PhysConstVectorData * { return a.physicsVector; });
                                                         ^~~~~~~~~~~~~~~~~~~~~
                                                         G4VMPLData::G4PhysConstVectorData
./A.h:19:11: note: 'G4VMPLData::G4PhysConstVectorData' declared here
    using G4PhysConstVectorData = std::vector<G4VPhysicsConstructor*>;
          ^
libTestUsingType/src/jlTestUsingType.cxx:68:52: error: unknown type name 'G4PhysConstVectorData'; did you mean 'G4VMPLData::G4PhysConstVectorData'?
    t.method("physicsVector", [](G4VMPLData& a) -> G4PhysConstVectorData * { return a.physicsVector; });
                                                   ^~~~~~~~~~~~~~~~~~~~~
                                                   G4VMPLData::G4PhysConstVectorData
./A.h:19:11: note: 'G4VMPLData::G4PhysConstVectorData' declared here
    using G4PhysConstVectorData = std::vector<G4VPhysicsConstructor*>;
          ^

I am attaching a reproducer: TestUsingType.zip

grasph commented 7 months ago

Unit test integrated and integration of PR #29 seems to have fixed it. Please test with HEAD (27924fc).

Reopen the issue if it does solve everything.

Philippe.