Description
Please help, I'm trying to figure out the reason, but still no luck. Maybe it is a bug.
Our project contains several .so which parts are building in different ways (for example, boost and other 3dp libs with standalone toolchains, main part which is bundled in aar with ndk-build and the app itself and jni part with gradle/cmake.
When I've switched to ndk16-b1 and libc++_shared all dynamic_cast's in c++ code from pointers to derived_class stored in std::list<base_class*> turned to nullptr.
For example:
class A {}
class B : A {}
std::list < A * > aList;
aList.add( new B() );
A* aPtr = aList.begin().get();
B* bPtr = dynamic_cast<B*>(aPtr);
// => bPtr = nullptr
This is only when libc++_shared is used.
I've tested with libc++_static, gnustl_shared & gnustl_static - the problem does not appear.
bPtr as expected is a pointer to object B added to list.
Any ideas?
Environment Details
- NDK Version: 16.0.4293906-beta1
- Build sytem: ndk-build + cmake + standalone toolchain
- Host OS: Ubuntu 16.04
- Compiler: clang c++14
- ABI: arm64-v8a
- STL: libc++_shared
- NDK API level: 21
- Device API level: 26
Description
Please help, I'm trying to figure out the reason, but still no luck. Maybe it is a bug.
Our project contains several .so which parts are building in different ways (for example, boost and other 3dp libs with standalone toolchains, main part which is bundled in aar with ndk-build and the app itself and jni part with gradle/cmake.
When I've switched to ndk16-b1 and libc++_shared all dynamic_cast's in c++ code from pointers to derived_class stored in std::list<base_class*> turned to nullptr.
For example:
This is only when libc++_shared is used.
I've tested with libc++_static, gnustl_shared & gnustl_static - the problem does not appear.
bPtr as expected is a pointer to object B added to list.
Any ideas?
Environment Details