when i try to build xrslam, under tag.h, error occurs all are related to only constexpr
error: non-type template argument is not a constant expression
Kindly help
home/xrslam/xrslam/src/xrslam/utility/tag.h:13:53: error: no return statement in constexpr function
[[nodiscard]] static constexpr std::string_view enum_value_name() noexcept {
^
/home/xrslam/xrslam/src/xrslam/utility/tag.h:42:39: error: constexpr variable 'valid' must be initialized by a constant expression
constexpr std::array<bool, n> valid{
^ ~
/home/xrslam/xrslam/src/xrslam/utility/tag.h:51:16: note: in instantiation of function template specialization 'xrslam_0_5_0::Tagged<xrslam_0_5_0::FrameTag, void>::enum_value_count<0, 1, 2, 3, 4, 5, 6, 7,
8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57,
58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105,
106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127>' requested here
return enum_value_count(all_possible_tags);
^
/home/xrslam/xrslam/src/xrslam/utility/tag.h:54:45: note: in instantiation of member function 'xrslam_0_5_0::Tagged<xrslam_0_5_0::FrameTag, void>::enum_size' requested here
static constexpr size_t tag_enum_size = enum_size();
^
/home/xrslam/xrslam/src/xrslam/utility/tag.h:55:32: note: in instantiation of static data member 'xrslam_0_5_0::Tagged<xrslam_0_5_0::FrameTag, void>::tag_enum_size' requested here
using bitset = std::bitset;
^
/home/xrslam/xrslam/src/xrslam/map/frame.h:24:22: note: in instantiation of template class 'xrslam_0_5_0::Tagged<xrslam_0_5_0::FrameTag, void>' requested here
class Frame : public Tagged, public Identifiable {
^
/home/xrslam/xrslam/src/xrslam/utility/tag.h:36:5: note: control reached end of constexpr function
}
^
/home/xrslam/xrslam/src/xrslam/utility/tag.h:43:15: note: in call to 'enum_value_name()'
{!enum_value_name<static_cast(I)>().empty()...}};
^
/home/xrslam/xrslam/src/xrslam/utility/tag.h:44:23: error: constexpr variable 'num_valid' must be initialized by a constant expression
constexpr int num_valid = ((valid[I] ? 1 : 0) + ...);
^ ~~~~~~
/home/xrslam/xrslam/src/xrslam/utility/tag.h:44:37: note: initializer of 'valid' is not a constant expression
constexpr int num_valid = ((valid[I] ? 1 : 0) + ...);
^
/home/xrslam/xrslam/src/xrslam/utility/tag.h:42:39: note: declared here
constexpr std::array<bool, n> valid{
^
/home/xrslam/xrslam/src/xrslam/utility/tag.h:54:29: error: constexpr variable 'tag_enum_size' must be initialized by a constant expression
static constexpr size_t tag_enum_size = enum_size();
^ ~~~
/home/xrslam/xrslam/src/xrslam/utility/tag.h:55:32: note: in instantiation of static data member 'xrslam_0_5_0::Tagged<xrslam_0_5_0::FrameTag, void>::tag_enum_size' requested here
using bitset = std::bitset;
^
/home/xrslam/xrslam/src/xrslam/map/frame.h:24:22: note: in instantiation of template class 'xrslam_0_5_0::Tagged<xrslam_0_5_0::FrameTag, void>' requested here
class Frame : public Tagged, public Identifiable {
^
/home/xrslam/xrslam/src/xrslam/utility/tag.h:36:5: note: control reached end of constexpr function
}
^
/home/xrslam/xrslam/src/xrslam/utility/tag.h:43:15: note: in call to 'enum_value_name()'
{!enum_value_name<static_cast(I)>().empty()...}};
^
/home/xrslam/xrslam/src/xrslam/utility/tag.h:51:16: note: in call to 'enum_value_count({})'
return enum_value_count(all_possible_tags);
@huanggan52 @wangnancpp
when i try to build xrslam, under tag.h, error occurs all are related to only constexpr error: non-type template argument is not a constant expression Kindly help
home/xrslam/xrslam/src/xrslam/utility/tag.h:13:53: error: no return statement in constexpr function [[nodiscard]] static constexpr std::string_view enum_value_name() noexcept { ^ /home/xrslam/xrslam/src/xrslam/utility/tag.h:42:39: error: constexpr variable 'valid' must be initialized by a constant expression constexpr std::array<bool, n> valid{ ^ ~ /home/xrslam/xrslam/src/xrslam/utility/tag.h:51:16: note: in instantiation of function template specialization 'xrslam_0_5_0::Tagged<xrslam_0_5_0::FrameTag, void>::enum_value_count<0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127>' requested here return enum_value_count(all_possible_tags); ^ /home/xrslam/xrslam/src/xrslam/utility/tag.h:54:45: note: in instantiation of member function 'xrslam_0_5_0::Tagged<xrslam_0_5_0::FrameTag, void>::enum_size' requested here static constexpr size_t tag_enum_size = enum_size(); ^ /home/xrslam/xrslam/src/xrslam/utility/tag.h:55:32: note: in instantiation of static data member 'xrslam_0_5_0::Tagged<xrslam_0_5_0::FrameTag, void>::tag_enum_size' requested here using bitset = std::bitset;
^
/home/xrslam/xrslam/src/xrslam/map/frame.h:24:22: note: in instantiation of template class 'xrslam_0_5_0::Tagged<xrslam_0_5_0::FrameTag, void>' requested here
class Frame : public Tagged, public Identifiable {
^
/home/xrslam/xrslam/src/xrslam/utility/tag.h:36:5: note: control reached end of constexpr function
}
^
/home/xrslam/xrslam/src/xrslam/utility/tag.h:43:15: note: in call to 'enum_value_name()'
{!enum_value_name<static_cast(I)>().empty()...}};
^
/home/xrslam/xrslam/src/xrslam/utility/tag.h:44:23: error: constexpr variable 'num_valid' must be initialized by a constant expression
constexpr int num_valid = ((valid[I] ? 1 : 0) + ...);
^ ;
^
/home/xrslam/xrslam/src/xrslam/map/frame.h:24:22: note: in instantiation of template class 'xrslam_0_5_0::Tagged<xrslam_0_5_0::FrameTag, void>' requested here
class Frame : public Tagged, public Identifiable {
^
/home/xrslam/xrslam/src/xrslam/utility/tag.h:36:5: note: control reached end of constexpr function
}
^
/home/xrslam/xrslam/src/xrslam/utility/tag.h:43:15: note: in call to 'enum_value_name()'
{!enum_value_name<static_cast(I)>().empty()...}};
^
/home/xrslam/xrslam/src/xrslam/utility/tag.h:51:16: note: in call to 'enum_value_count({})'
return enum_value_count(all_possible_tags);
~~~~~~ /home/xrslam/xrslam/src/xrslam/utility/tag.h:44:37: note: initializer of 'valid' is not a constant expression constexpr int num_valid = ((valid[I] ? 1 : 0) + ...); ^ /home/xrslam/xrslam/src/xrslam/utility/tag.h:42:39: note: declared here constexpr std::array<bool, n> valid{ ^ /home/xrslam/xrslam/src/xrslam/utility/tag.h:54:29: error: constexpr variable 'tag_enum_size' must be initialized by a constant expression static constexpr size_t tag_enum_size = enum_size(); ^~~~ /home/xrslam/xrslam/src/xrslam/utility/tag.h:55:32: note: in instantiation of static data member 'xrslam_0_5_0::Tagged<xrslam_0_5_0::FrameTag, void>::tag_enum_size' requested here using bitset = std::bitset