Hello everyone,
I am new here and in fact not subscribed, I just have a question and don’t even know if I am at the right address.
We recently found a bug in our product code when building with NDK Clang for Android and it is related to the LLVM libcxx. It is fairly easy to reproduce and a quick internet search reveals that we are not the only ones with this or a similar issue.
What we did, was
#define hash #
before
#include <math.h>
which let to a problem with libcxx/include/type_traits:417
template <class _Tp> struct _LIBCPP_TEMPLATE_VIS hash;
of course. We obviously shouldn’t let defines leak into the stdlib, so it is our fault, we fixed it simply by renaming the define.
I didn’t want to post it as a bug in the LLVM bugtracker, because I don’t even think it needs fixing on LLVM side. I just wanted to make aware that this issue exists for some people and wanted to ask if there is a way to publicly document this issue somewhere, so people having problems with this can potentially find a solution on the internet.
Best regards,
O. Major
Hello everyone,
I am new here and in fact not subscribed, I just have a question and don’t even know if I am at the right address.
We recently found a bug in our product code when building with NDK Clang for Android and it is related to the LLVM libcxx. It is fairly easy to reproduce and a quick internet search reveals that we are not the only ones with this or a similar issue.
What we did, was
#define hash #
before
#include <math.h>
which let to a problem with libcxx/include/type_traits:417
template <class _Tp> struct _LIBCPP_TEMPLATE_VIS hash;
of course. We obviously shouldn’t let defines leak into the stdlib, so it is our fault, we fixed it simply by renaming the define.
Good.
I didn’t want to post it as a bug in the LLVM bugtracker, because I don’t even think it needs fixing on LLVM side. I just wanted to make aware that this issue exists for some people and wanted to ask if there is a way to publicly document this issue somewhere, so people having problems with this can potentially find a solution on the internet.
You’re not allowed to #define names that are defined in the standard library…
See http://eel.is/c++draft/macro.names, which states:
A translation unit that includes a standard library header shall not #define or #undef names declared in any standard library header.
— Marshall
Thanks a lot, that was exactly what I was looking for!
Best regards,
O. Major