install with
Code: Select all
conda create -n <name> freecad occt=7.0.0
Code: Select all
conda install freecad netgen occt=7.0.0
https://www.opencascade.com/doc/occt-7. ... cct700_cdl
Code: Select all
conda create -n <name> freecad occt=7.0.0
Code: Select all
conda install freecad netgen occt=7.0.0
Code: Select all
Handle_Geom_TrimmedCurve::DownCast(handle())
Code: Select all
Handle(TrimmedCurve)::DownCast(handle())
Peter, do you have a brach somewhere? I can test on VS2013peterl94 wrote:Indeed! That fixed the issue.
Now I do. https://github.com/peterl94/FreeCAD_sf_ ... pgrade-tmpsgrogan wrote:Peter, do you have a brach somewhere?
Thanks! VS2013 only switching out occt7.1/occt7.0 compiles and passes all self tests. A quick run thru Sketcher, Part, Part design, and Reverse engineering shows no problems.peterl94 wrote:Now I do. https://github.com/peterl94/FreeCAD_sf_ ... pgrade-tmp
Just to be clear with /GR- you actively disable RTTI. The standard behaviour is that RTTI is enabled (/GR). As a test have a look at this example:peterl94 wrote:I saw that too, but I checked the compiler flags and /GR is present. I wonder if it is a problem with a 3rd party library.DeepSOIC wrote:Reading the internet, I found that /GR- flag should be added to compiler for dynamic_casts to work
Code: Select all
class A {
public:
virtual void test()
{
}
};
class B : public A {
public:
virtual void test()
{
int i=0;
i++;
}
};
int main(int, char **)
{
A* a = new B();
B* b = dynamic_cast<B*>(a);
}
And when running the application it crashes and the debugger shows this message:main.cpp(20) : warning C4541: 'dynamic_cast' used on polymorphic type 'A' with /GR-; unpredictable behavior may result
Unhandled exception at 0x000007fefd5aa06d in main.exe: Microsoft C++ exception: std::__non_rtti_object at memory location 0x0022fbc8..
Code: Select all
//! Define Handle() macro
#define Handle(Class) opencascade::handle<Class>
#define DEFINE_STANDARD_HANDLECLASS(C1,C2,BC) class C1; typedef Handle(C1) Handle_##C1;
Code: Select all
//! Define Handle() macro
#define Handle(Class) opencascade::handle<Class>
//! For compatibility with previous versions of OCCT, define Handle_Class alias for opencascade::handle<Class>.
#if (defined(_MSC_VER) && _MSC_VER >= 1800)
//! For Visual Studio 2013+, define Handle_Class as non-template class to allow exporting this type in C++/CLI.
#define DEFINE_STANDARD_HANDLECLASS(C1,C2,BC) class C1; class Handle_##C1 : public Handle(C1) \
{ \
public: \
Handle_##C1() {} \
Handle_##C1(Handle(C1)&& theHandle) : Handle(C1)(theHandle) {} \
template <class T2, typename = typename std::enable_if <std::is_base_of <C1,T2>::value>::type> \
inline Handle_##C1(const opencascade::handle<T2>& theOther) : Handle(C1)(theOther) {} \
template <class T2, typename = typename std::enable_if <std::is_base_of <C1,T2>::value>::type> \
inline Handle_##C1(const T2* theOther) : Handle(C1)(theOther) {} \
template<typename T> inline Handle_##C1& operator=(T theOther) { Handle(C1)::operator=(theOther); return *this; } \
};
#else
//! For other compilers, use simple typedef
#define DEFINE_STANDARD_HANDLECLASS(C1,C2,BC) class C1; typedef Handle(C1) Handle_##C1;
#endif
I would say this is a serious bug.For compatibility with previous versions of OCCT, define Handle_Class alias for opencascade::handle<Class>.
I think it's mandatory to change it only when used with DownCast. I just wonder if there is a way we can actively forbid the deprecated Handle_ notation in the future since this causes hard to find bugs.peterl94 wrote:The script makes small changes all over the place and I don't know if all Handle_ changes are necessary: "148 files changed, 2235 insertions(+), 2257 deletions(-)"