pulsar-client-cpp icon indicating copy to clipboard operation
pulsar-client-cpp copied to clipboard

[Bug] Many C++ errors due to c++11

Open yurivict opened this issue 1 year ago • 0 comments

Search before asking

  • [X] I searched in the issues and found nothing similar.

Version

pulsar-client-3.6.0 clang-18 FreeBSD 14.1

Minimal reproduce step

build

What did you expect to see?

n/a

What did you see instead?

In file included from /usr/ports/net-p2p/pulsar-client-cpp/work/pulsar-client-cpp-3.6.0/lib/BatchMessageKeyBasedContainer.cc:27:
In file included from /usr/ports/net-p2p/pulsar-client-cpp/work/pulsar-client-cpp-3.6.0/lib/MessageImpl.h:26:
In file included from /usr/ports/net-p2p/pulsar-client-cpp/work/.build/generated/lib/PulsarApi.pb.h:20:
In file included from /usr/local/include/google/protobuf/io/coded_stream.h:108:
In file included from /usr/local/include/google/protobuf/stubs/common.h:21:
In file included from /usr/local/include/absl/strings/string_view.h:39:
In file included from /usr/local/include/absl/base/attributes.h:37:
In file included from /usr/local/include/absl/base/config.h:92:
/usr/local/include/absl/base/policy_checks.h:79:2: error: "C++ versions less than C++14 are not supported."
   79 | #error "C++ versions less than C++14 are not supported."
      |  ^
In file included from /usr/ports/net-p2p/pulsar-client-cpp/work/pulsar-client-cpp-3.6.0/lib/BatchMessageKeyBasedContainer.cc:27:
In file included from /usr/ports/net-p2p/pulsar-client-cpp/work/pulsar-client-cpp-3.6.0/lib/MessageImpl.h:26:
In file included from /usr/ports/net-p2p/pulsar-client-cpp/work/.build/generated/lib/PulsarApi.pb.h:20:
In file included from /usr/local/include/google/protobuf/io/coded_stream.h:108:
In file included from /usr/local/include/google/protobuf/stubs/common.h:21:
In file included from /usr/local/include/absl/strings/string_view.h:40:
In file included from /usr/local/include/absl/base/nullability.h:162:
In file included from /usr/local/include/absl/base/internal/nullability_impl.h:23:
/usr/local/include/absl/meta/type_traits.h:586:5: error: no template named 'enable_if_t' in namespace 'std'; did you mean simply 'enable_if_t'?
  586 |     std::enable_if_t<std::is_class<typename T::absl_internal_is_view>::value>>
      |     ^~~~~~~~~~~~~~~~
      |     enable_if_t
/usr/local/include/absl/meta/type_traits.h:296:1: note: 'enable_if_t' declared here
  296 | using enable_if_t = typename std::enable_if<B, T>::type;
      | ^
/usr/local/include/absl/meta/type_traits.h:618:5: error: no template named 'enable_if_t' in namespace 'std'; did you mean simply 'enable_if_t'?
  618 |     std::enable_if_t<std::is_class<typename T::absl_internal_is_view>::value>>
      |     ^~~~~~~~~~~~~~~~
      |     enable_if_t
/usr/local/include/absl/meta/type_traits.h:296:1: note: 'enable_if_t' declared here
  296 | using enable_if_t = typename std::enable_if<B, T>::type;
      | ^
In file included from /usr/ports/net-p2p/pulsar-client-cpp/work/pulsar-client-cpp-3.6.0/lib/BatchMessageKeyBasedContainer.cc:27:
In file included from /usr/ports/net-p2p/pulsar-client-cpp/work/pulsar-client-cpp-3.6.0/lib/MessageImpl.h:26:
In file included from /usr/ports/net-p2p/pulsar-client-cpp/work/.build/generated/lib/PulsarApi.pb.h:20:
In file included from /usr/local/include/google/protobuf/io/coded_stream.h:108:
In file included from /usr/local/include/google/protobuf/stubs/common.h:21:
In file included from /usr/local/include/absl/strings/string_view.h:40:
In file included from /usr/local/include/absl/base/nullability.h:162:
/usr/local/include/absl/base/internal/nullability_impl.h:41:16: error: variable templates are a C++14 extension [-Werror,-Wc++14-extensions]
   41 | constexpr bool IsSupportedType = IsNullabilityCompatible<T>::value;
      |                ^
/usr/local/include/absl/base/internal/nullability_impl.h:57:55: error: no template named 'remove_cv_t' in namespace 'std'; did you mean simply 'remove_cv_t'?
   57 |   static_assert(nullability_internal::IsSupportedType<std::remove_cv_t<T>>,
      |                                                       ^~~~~~~~~~~~~~~~
      |                                                       remove_cv_t
/usr/local/include/absl/meta/type_traits.h:248:1: note: 'remove_cv_t' declared here
  248 | using remove_cv_t = typename std::remove_cv<T>::type;
      | ^
In file included from /usr/ports/net-p2p/pulsar-client-cpp/work/pulsar-client-cpp-3.6.0/lib/BatchMessageKeyBasedContainer.cc:27:
In file included from /usr/ports/net-p2p/pulsar-client-cpp/work/pulsar-client-cpp-3.6.0/lib/MessageImpl.h:26:
In file included from /usr/ports/net-p2p/pulsar-client-cpp/work/.build/generated/lib/PulsarApi.pb.h:20:
In file included from /usr/local/include/google/protobuf/io/coded_stream.h:108:
In file included from /usr/local/include/google/protobuf/stubs/common.h:21:
In file included from /usr/local/include/absl/strings/string_view.h:40:
In file included from /usr/local/include/absl/base/nullability.h:162:
/usr/local/include/absl/base/internal/nullability_impl.h:65:55: error: no template named 'remove_cv_t' in namespace 'std'; did you mean simply 'remove_cv_t'?
   65 |   static_assert(nullability_internal::IsSupportedType<std::remove_cv_t<T>>,
      |                                                       ^~~~~~~~~~~~~~~~
      |                                                       remove_cv_t
/usr/local/include/absl/meta/type_traits.h:248:1: note: 'remove_cv_t' declared here
  248 | using remove_cv_t = typename std::remove_cv<T>::type;
      | ^
In file included from /usr/ports/net-p2p/pulsar-client-cpp/work/pulsar-client-cpp-3.6.0/lib/BatchMessageKeyBasedContainer.cc:27:
In file included from /usr/ports/net-p2p/pulsar-client-cpp/work/pulsar-client-cpp-3.6.0/lib/MessageImpl.h:26:
In file included from /usr/ports/net-p2p/pulsar-client-cpp/work/.build/generated/lib/PulsarApi.pb.h:20:
In file included from /usr/local/include/google/protobuf/io/coded_stream.h:108:
In file included from /usr/local/include/google/protobuf/stubs/common.h:21:
In file included from /usr/local/include/absl/strings/string_view.h:40:
In file included from /usr/local/include/absl/base/nullability.h:162:
/usr/local/include/absl/base/internal/nullability_impl.h:73:55: error: no template named 'remove_cv_t' in namespace 'std'; did you mean simply 'remove_cv_t'?
   73 |   static_assert(nullability_internal::IsSupportedType<std::remove_cv_t<T>>,
      |                                                       ^~~~~~~~~~~~~~~~
      |                                                       remove_cv_t
/usr/local/include/absl/meta/type_traits.h:248:1: note: 'remove_cv_t' declared here
  248 | using remove_cv_t = typename std::remove_cv<T>::type;
      | ^
In file included from /usr/ports/net-p2p/pulsar-client-cpp/work/pulsar-client-cpp-3.6.0/lib/BatchMessageKeyBasedContainer.cc:27:
In file included from /usr/ports/net-p2p/pulsar-client-cpp/work/pulsar-client-cpp-3.6.0/lib/MessageImpl.h:26:
In file included from /usr/ports/net-p2p/pulsar-client-cpp/work/.build/generated/lib/PulsarApi.pb.h:20:
In file included from /usr/local/include/google/protobuf/io/coded_stream.h:108:
In file included from /usr/local/include/google/protobuf/stubs/common.h:23:
In file included from /usr/local/include/google/protobuf/stubs/port.h:22:
/usr/local/include/google/protobuf/port_def.inc:119:15: error: static assertion failed due to requirement '201103L >= 201402L': Protobuf only supports C++14 and newer.
  119 | static_assert(PROTOBUF_CPLUSPLUS_MIN(201402L), "Protobuf only supports C++14 and newer.");
      |               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/include/google/protobuf/port_def.inc:105:36: note: expanded from macro 'PROTOBUF_CPLUSPLUS_MIN'
  105 | #define PROTOBUF_CPLUSPLUS_MIN(x) (__cplusplus >= x)
      |                                    ^~~~~~~~~~~~~~~~
<built-in>:420:21: note: expanded from macro '__cplusplus'
  420 | #define __cplusplus 201103L
      |                     ^
In file included from /usr/ports/net-p2p/pulsar-client-cpp/work/pulsar-client-cpp-3.6.0/lib/BatchMessageKeyBasedContainer.cc:27:
In file included from /usr/ports/net-p2p/pulsar-client-cpp/work/pulsar-client-cpp-3.6.0/lib/MessageImpl.h:26:
In file included from /usr/ports/net-p2p/pulsar-client-cpp/work/.build/generated/lib/PulsarApi.pb.h:20:
In file included from /usr/local/include/google/protobuf/io/coded_stream.h:108:
In file included from /usr/local/include/google/protobuf/stubs/common.h:35:
/usr/local/include/google/protobuf/port_def.inc:119:15: error: static assertion failed due to requirement '201103L >= 201402L': Protobuf only supports C++14 and newer.
  119 | static_assert(PROTOBUF_CPLUSPLUS_MIN(201402L), "Protobuf only supports C++14 and newer.");
      |               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/include/google/protobuf/port_def.inc:105:36: note: expanded from macro 'PROTOBUF_CPLUSPLUS_MIN'
  105 | #define PROTOBUF_CPLUSPLUS_MIN(x) (__cplusplus >= x)
      |                                    ^~~~~~~~~~~~~~~~
<built-in>:420:21: note: expanded from macro '__cplusplus'
  420 | #define __cplusplus 201103L
      |                     ^
In file included from /usr/ports/net-p2p/pulsar-client-cpp/work/pulsar-client-cpp-3.6.0/lib/BatchMessageKeyBasedContainer.cc:27:
In file included from /usr/ports/net-p2p/pulsar-client-cpp/work/pulsar-client-cpp-3.6.0/lib/MessageImpl.h:26:
In file included from /usr/ports/net-p2p/pulsar-client-cpp/work/.build/generated/lib/PulsarApi.pb.h:20:
In file included from /usr/local/include/google/protobuf/io/coded_stream.h:110:
In file included from /usr/local/include/absl/log/absl_check.h:38:
In file included from /usr/local/include/absl/log/internal/check_impl.h:19:
In file included from /usr/local/include/absl/log/internal/check_op.h:38:
In file included from /usr/local/include/absl/log/internal/nullstream.h:36:
/usr/local/include/absl/base/log_severity.h:102:3: error: use of this statement in a constexpr function is a C++14 extension [-Werror,-Wc++14-extensions]
  102 |   switch (s) {
      |   ^
/usr/local/include/absl/base/log_severity.h:108:3: error: multiple return statements in constexpr function is a C++14 extension [-Werror,-Wc++14-extensions]
  108 |   return "UNKNOWN";
      |   ^
/usr/local/include/absl/base/log_severity.h:103:36: note: previous return statement is here
  103 |     case absl::LogSeverity::kInfo: return "INFO";
      |                                    ^
/usr/local/include/absl/base/log_severity.h:104:39: note: previous return statement is here
  104 |     case absl::LogSeverity::kWarning: return "WARNING";
      |                                       ^
/usr/local/include/absl/base/log_severity.h:105:37: note: previous return statement is here
  105 |     case absl::LogSeverity::kError: return "ERROR";
      |                                     ^
/usr/local/include/absl/base/log_severity.h:106:37: note: previous return statement is here
  106 |     case absl::LogSeverity::kFatal: return "FATAL";
      |                                     ^
/usr/local/include/absl/base/log_severity.h:116:21: error: variable declaration in a constexpr function is a C++14 extension [-Werror,-Wc++14-extensions]
  116 |   absl::LogSeverity n = s;
      |                     ^
/usr/local/include/absl/base/log_severity.h:117:3: error: use of this statement in a constexpr function is a C++14 extension [-Werror,-Wc++14-extensions]
  117 |   if (n < absl::LogSeverity::kInfo) n = absl::LogSeverity::kInfo;
      |   ^
In file included from /usr/ports/net-p2p/pulsar-client-cpp/work/pulsar-client-cpp-3.6.0/lib/BatchMessageKeyBasedContainer.cc:27:
In file included from /usr/ports/net-p2p/pulsar-client-cpp/work/pulsar-client-cpp-3.6.0/lib/MessageImpl.h:26:
In file included from /usr/ports/net-p2p/pulsar-client-cpp/work/.build/generated/lib/PulsarApi.pb.h:20:
In file included from /usr/local/include/google/protobuf/io/coded_stream.h:110:
In file included from /usr/local/include/absl/log/absl_check.h:38:
In file included from /usr/local/include/absl/log/internal/check_impl.h:19:
In file included from /usr/local/include/absl/log/internal/check_op.h:39:
In file included from /usr/local/include/absl/log/internal/strip.h:25:
In file included from /usr/local/include/absl/log/internal/log_message.h:41:
In file included from /usr/local/include/absl/log/log_entry.h:35:
/usr/local/include/absl/time/time.h:284:22: error: 'constexpr' non-static member function will not be implicitly 'const' in C++14; add 'const' to avoid a change in behavior [-Werror,-Wconstexpr-not-const]
  284 |     constexpr HiRep& operator=(const int64_t value) {
      |                      ^
      |                                                     const
/usr/local/include/absl/time/time.h:261:7: error: use of this statement in a constexpr constructor is a C++14 extension [-Werror,-Wc++14-extensions]
  261 |       *this = value;
      |       ^
/usr/local/include/absl/time/time.h:265:22: error: variable declaration in a constexpr function is a C++14 extension [-Werror,-Wc++14-extensions]
  265 |       const uint64_t unsigned_value =
      |                      ^
/usr/local/include/absl/time/time.h:290:11: error: cannot assign to non-static data member within const member function 'operator='
  290 |       hi_ = static_cast<uint32_t>(unsigned_value >> 32);
      |       ~~~ ^
/usr/local/include/absl/time/time.h:284:22: note: member function 'absl::Duration::HiRep::operator=' is declared const here
  284 |     constexpr HiRep& operator=(const int64_t value) {
      |     ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/include/absl/time/time.h:291:11: error: cannot assign to non-static data member within const member function 'operator='
  291 |       lo_ = static_cast<uint32_t>(unsigned_value);
      |       ~~~ ^
/usr/local/include/absl/time/time.h:284:22: note: member function 'absl::Duration::HiRep::operator=' is declared const here
  284 |     constexpr HiRep& operator=(const int64_t value) {
      |     ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/include/absl/time/time.h:292:14: error: binding reference of type 'HiRep' to value of type 'const absl::Duration::HiRep' drops 'const' qualifier
  292 |       return *this;
      |              ^~~~~
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.

Anything else?

Use of C++11 appears to conflict with various C++ elements and libabsl.

It builds fine with -std=c++17.

Are you willing to submit a PR?

  • [ ] I'm willing to submit a PR!

yurivict avatar Oct 04 '24 02:10 yurivict