Here我向Android程序寻求帮助,该程序在insert()崩溃到unordered_set时崩溃。
我的想法是用g ++而不是clang编译该源代码(这是android开发唯一受支持的编译器)。也许该程序在用g ++编译时可以工作...
但是由于g++ -std=gnu++17 hiddenapi.cc > hiddenapi.log 2>&1
,我遇到了无法修复的错误,因为我从未见过:
In file included from dex_file.h:32:0,
from compact_dex_file.h:21,
from dex_file-inl.h:23,
from hiddenapi.cc:27:
hidden_api_access_flags.h:106:40: error: ‘constexpr int art::CTZ(T) [with T = unsigned int]’ called in a constant expression
static const int kAccFlagsShift = CTZ(kAccHiddenApiBits);
~~~^~~~~~~~~~~~~~~~~~~
In file included from leb128.h:24:0,
from dex_file-inl.h:21,
from hiddenapi.cc:27:
bit_utils.h:68:15: note: ‘constexpr int art::CTZ(T) [with T = unsigned int]’ is not usable as a constexpr function because:
constexpr int CTZ(T x) {
^~~
In file included from casts.h:27:0,
from dex_file-inl.h:20,
from hiddenapi.cc:27:
alogging.h:285:39: error: call to non-constexpr function ‘std::basic_ostream<char, _Traits>& std::operator<<(std::basic_ostream<char, _Traits>&, const char*) [with _Traits = std::char_traits<char>]’
::android::base::LogMessage(__FILE__, __LINE__, ::android::base::DEFAULT, \
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
::android::base::FATAL, _LOG_TAG_INTERNAL, -1) \
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.stream() \
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
<< "Check failed: " << #LHS << " " << #OP << " " << #RHS << " (" #LHS "=" << _values.lhs \
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
<< ", " #RHS "=" << _values.rhs << ") "
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~
alogging.h:295:24: note: in expansion of macro ‘CHECK_OP’
#define CHECK_NE(x, y) CHECK_OP(x, y, != )
^~~~~~~~
alogging.h:356:40: note: in expansion of macro ‘CHECK_NE’
if (::android::base::kEnableDChecks) CHECK_NE(x, y)
^~~~~~~~
bit_utils.h:74:3: note: in expansion of macro ‘DCHECK_NE’
DCHECK_NE(x, static_cast<T>(0));
^~~~~~~~~