diff --git a/iguana/pb_writer.hpp b/iguana/pb_writer.hpp index fadc6c3e..4c39305a 100644 --- a/iguana/pb_writer.hpp +++ b/iguana/pb_writer.hpp @@ -206,6 +206,8 @@ IGUANA_INLINE void to_pb_impl(Type&& t, It&& it, uint32_t*& sz_ptr) { } } +#if defined(__clang__) || defined(_MSC_VER) || \ + (defined(__GNUC__) && __GNUC__ > 8) template IGUANA_INLINE constexpr std::string_view get_type_string() { if constexpr (std::is_integral_v) { @@ -443,7 +445,7 @@ IGUANA_INLINE void build_sub_proto(Map& map, std::string_view str_type, map.emplace(str_type, std::move(sub_str)); } } - +#endif } // namespace detail template @@ -455,6 +457,8 @@ IGUANA_INLINE void to_pb(T& t, Stream& out) { detail::to_pb_impl<0>(t, &out[0], sz_ptr); } +#if defined(__clang__) || defined(_MSC_VER) || \ + (defined(__GNUC__) && __GNUC__ > 8) template IGUANA_INLINE void to_proto(Stream& out, std::string_view ns = "") { if (gen_header) { @@ -484,6 +488,7 @@ IGUANA_INLINE void to_proto_file(Stream& stream, std::string_view ns = "") { to_proto(out, ns); stream.write(out.data(), out.size()); } +#endif template IGUANA_INLINE void to_pb_adl(iguana_adl_t* p, T& t, Stream& out) { diff --git a/test/test_pb.cpp b/test/test_pb.cpp index daf312ab..85e27988 100644 --- a/test/test_pb.cpp +++ b/test/test_pb.cpp @@ -275,6 +275,8 @@ struct vector_t { }; REFLECTION(vector_t, id, color, variant, ids, pairs, strs, map, name, op_val); +#if defined(__clang__) || defined(_MSC_VER) || \ + (defined(__GNUC__) && __GNUC__ > 8) TEST_CASE("struct to proto") { { std::string str; @@ -333,6 +335,7 @@ TEST_CASE("struct to proto") { CHECK(str.find("int32 age = 3;") != std::string::npos); } } +#endif TEST_CASE("test reflection") { { diff --git a/test/test_proto3.cpp b/test/test_proto3.cpp index 2a50d0aa..2612b16e 100644 --- a/test/test_proto3.cpp +++ b/test/test_proto3.cpp @@ -297,6 +297,8 @@ TEST_CASE("test RepeatIguanaTypeMsg") { } TEST_CASE("test NestedMsg") { +#if defined(__clang__) || defined(_MSC_VER) || \ + (defined(__GNUC__) && __GNUC__ > 8) { std::string str; iguana::to_proto(str, "test"); @@ -305,6 +307,7 @@ TEST_CASE("test NestedMsg") { std::ofstream out("NestedMsg.proto", std::ios::binary); iguana::to_proto_file(out, "test"); } +#endif { stpb::NestedMsg se_st{ /* base_msg */ stpb::BaseTypeMsg{100, 200, 300, 400, 31.4f, 62.8, false,