mpictor/StepClassLibrary — Issue #133: compiler errors with AP210E3, AP235, AP242
Author: mpictor
Created: 2012-02-04 16:28:02+00:00
State: open

On master, [this small schema](http://github.com/mpictor/StepClassLibrary/blob/mp/gcc_incomplete_type/test/unitary_schemas/gcc_incomplete_type.exp) produces compiler errors such as:

In file included from schema.h:43:0,
from SdaiGCC_INCOMPLETE_TYPE.cc:10:
SdaiGCC_INCOMPLETE_TYPE.h:26:30: error: field ‘_sdaiatom_based_value_agg’ has incomplete type
SdaiGCC_INCOMPLETE_TYPE.cc: In member function ‘virtual void SdaiAtom_based_value::STEPwrite_content(std::ostream&, const char*) const’:
SdaiGCC_INCOMPLETE_TYPE.cc:65:2: error: ‘_sdaiatom_based_value_agg’ was not declared in this scope

(output is snipped)

Two of the generated c++ classes embed each other:

```C++

class SdaiAtom_based_value : public SDAI_Select {
protected:
SDAI_Real _real;
SdaiAtom_based_value_agg _sdaiatom_based_value_agg;
public:
// ...
};

class SdaiAtom_based_value_agg : public SelectAggregate {
public:
virtual SingleLinkNode * NewNode()
{ return new SelectNode (new SdaiAtom_based_value( sel_type )); }
// ...
};
```
@brlcad suggested using a pointer, so that
` SdaiAtom_based_value_agg _sdaiatom_based_value_agg;`
becomes
` SdaiAtom_based_value_agg * _sdaiatom_based_value_agg;`

I implemented this in branch [mp/gcc_incomplete_type](http://github.com/mpictor/StepClassLibrary/tree/mp/gcc_incomplete_type). It works for small schema linked above, but there are still problems with the full-size schemas. An example, with shortened file names, from AP242:

SdaiAP242_LF.cc: In member function ‘virtual void SdaiSpatial_rotation::STEPwrite_content(std::ostream&, const char*) const’:
SdaiAP242_LF.cc:115711:20: error: request for member ‘STEPwrite’ in ‘((const SdaiSpatial_rotation*)this)->SdaiSpatial_rotation::_realaggregate’, which is of non-class type ‘const RealAggregate_ptr {aka RealAggregate* const}’
SdaiAP242_LF.cc: In member function ‘virtual void SdaiSpatial_rotation::STEPwrite_verbose(std::ostream&, const char*) const’:
SdaiAP242_LF.cc:115749:20: error: request for member ‘STEPwrite’ in ‘((const SdaiSpatial_rotation*)this)->SdaiSpatial_rotation::_realaggregate’, which is of non-class type ‘const RealAggregate_ptr {aka RealAggregate* const}’
SdaiAP242_LF.cc: In member function ‘virtual Severity SdaiSpatial_rotation::STEPread_content(std::istream&, InstMgr*, const char*, int, const char*)’:
SdaiAP242_LF.cc:115770:20: error: request for member ‘STEPread’ in ‘((SdaiSpatial_rotation*)this)->SdaiSpatial_rotation::_realaggregate’, which is of non-class type ‘RealAggregate_ptr {aka RealAggregate*}’