Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#106 Compilation errors with Clang and c++11

Release 3.0
pending
nobody
Assimp lib (91)
5
2013-09-28
2012-12-15
Frederik Aalund
No

As per the discussion in: https://sourceforge.net/mailarchive/forum.php?thread_name=CAA%3DpTTRQw2LqCtwFs%3DVcL%2BRoxyEFoYEeu3pkv_hKi1RcW9R7uA%40mail.gmail.com&forum_name=assimp-discussions

I came across an issue when using clang and also clang's own
standard library implementation for c++11 (flags: -std=c++11
-stdlib=libc++). The LWSLoader.h defines the class
Element as follows:

class Element
{
public:
Element()
{}

// first: name, second: rest
std::string tokens[2];
std::list<Element> children;

//! Recursive parsing function
void Parse (const char*& buffer);
};

The problem arises from the line "std::list<Element> children;"
because the children list is defined using the Element class which is
an incomplete type at the time of declaration. That is, the Element
class is not fully defined yet when the children member is declared.

I don't have a quick fix for this issue but nevertheless I think it
can be trivially solved: Use Element pointers instead of pure
Elements. E.g.: "std::list<Element*> children;" or maybe more
appropriately "std::list<std::unique_ptr<Element> > children;". Even
though this fix changes the memory layout, it shouldn't have that big
of a performance impact since you are already using std::list which is
node-based.

Discussion

  • Kim Kulling
    Kim Kulling
    2013-09-28

    • status: open --> pending