favreau / bullet

Automatically exported from code.google.com/p/bullet
0 stars 0 forks source link

ZeroInitialize( T& ) does not compile on LLVM 3.0 #539

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
The bullet function:

template <typename T>
static inline void          ZeroInitialize(T& value)
{
        static const T  zerodummy;
    value=zerodummy;
}

is wrong according to Apple LLVM 3.0, that outputs the error "Default 
Initialization of an Object of const Type requires an User-Defined default 
Constructor" for various btSoftBody nested classes:
Tetra, Face, Link, Note, Material, Node.

I really think this should be correct C++, but it will stop compilation no 
matter what.

Original issue reported on code.google.com by tommaso....@gmail.com on 10 Sep 2011 at 9:43

GoogleCodeExporter commented 9 years ago
This is already fixed in the latest trunk:

template <typename T>
static inline void          ZeroInitialize(T& value)
{
    memset(&value,0,sizeof(T));
}

Thanks,
Erwin

Original comment by erwin.coumans on 12 Sep 2011 at 10:13