Skip to content

nghttp2 1.62.0: Multiple errors in template.h #2192

Description

@Schamschula

While updating nghttp2-tools to version under MacPorts 1.62.0 CI ran into the following errors on all supported OS versions (Note: the nghttp2 library complied correctly):

/usr/bin/clang++ -std=gnu++11 -DHAVE_CONFIG_H -I. -I..  -DPKGDATADIR='"/opt/local/share/nghttp2"' -DPKGLIBDIR='"/opt/local/lib/nghttp2"' -I../lib/includes -I../lib/includes -I../lib -I../third-party -I../third-party/llhttp/include -I/opt/local/include/libxml2 -I/opt/local/include/openssl -I/opt/local/include -D__APPLE_USE_RFC_3542 -DHAVE_CONFIG_H -I/opt/local/include -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk   -pipe -Os -stdlib=libc++ -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk -arch x86_64 -MT nghttp.o -MD -MP -MF $depbase.Tpo -c -o nghttp.o nghttp.cc &&\
	mv -f $depbase.Tpo $depbase.Po
In file included from http2.cc:25:
In file included from ./http2.h:40:
In file included from ./util.h:52:
/opt/local/include/ev.h:548:18: warning: mangled name of 'ev_set_allocator' will change in C++17 due to non-throwing exception specification in function signature [-Wc++17-compat-mangling]
EV_API_DECL void ev_set_allocator (void *(*cb)(void *ptr, long size) EV_NOEXCEPT) EV_NOEXCEPT;
                 ^
/opt/local/include/ev.h:554:18: warning: mangled name of 'ev_set_syserr_cb' will change in C++17 due to non-throwing exception specification in function signature [-Wc++17-compat-mangling]
EV_API_DECL void ev_set_syserr_cb (void (*cb)(const char *msg) EV_NOEXCEPT) EV_NOEXCEPT;
                 ^
/opt/local/include/ev.h:675:18: warning: mangled name of 'ev_set_loop_release_cb' will change in C++17 due to non-throwing exception specification in function signature [-Wc++17-compat-mangling]
EV_API_DECL void ev_set_loop_release_cb (EV_P_ void (*release)(EV_P) EV_NOEXCEPT, void (*acquire)(EV_P) EV_NOEXCEPT) EV_NOEXCEPT;
                 ^
In file included from util.cc:25:
In file included from ./util.h:52:
/opt/local/include/ev.h:548:18: warning: mangled name of 'ev_set_allocator' will change in C++17 due to non-throwing exception specification in function signature [-Wc++17-compat-mangling]
EV_API_DECL void ev_set_allocator (void *(*cb)(void *ptr, long size) EV_NOEXCEPT) EV_NOEXCEPT;
                 ^
/opt/local/include/ev.h:554:18: warning: mangled name of 'ev_set_syserr_cb' will change in C++17 due to non-throwing exception specification in function signature [-Wc++17-compat-mangling]
EV_API_DECL void ev_set_syserr_cb (void (*cb)(const char *msg) EV_NOEXCEPT) EV_NOEXCEPT;
                 ^
/opt/local/include/ev.h:675:18: warning: mangled name of 'ev_set_loop_release_cb' will change in C++17 due to non-throwing exception specification in function signature [-Wc++17-compat-mangling]
EV_API_DECL void ev_set_loop_release_cb (EV_P_ void (*release)(EV_P) EV_NOEXCEPT, void (*acquire)(EV_P) EV_NOEXCEPT) EV_NOEXCEPT;
                 ^
In file included from http2.cc:25:
In file included from ./http2.h:40:
In file included from ./util.h:57:
./template.h:61:27: error: no template named 'invoke_result_t' in namespace 'std'
  using ResultType = std::invoke_result_t<F, T...>;
                     ~~~~~^
./template.h:62:17: error: use of undeclared identifier 'ResultType'
  std::function<ResultType()> f;
                ^
./template.h:83:19: error: no member named 'exchange' in namespace 'std'
      : head{std::exchange(other.head, nullptr)},
             ~~~~~^
In file included from util.cc:25:
In file included from ./util.h:57:
./template.h:61:27: error: no template named 'invoke_result_t' in namespace 'std'
  using ResultType = std::invoke_result_t<F, T...>;
                     ~~~~~^
./template.h:84:19: ./template.h:62:17: error: use of undeclared identifier 'ResultType'
  std::function<ResultType()> f;
                ^
error: no member named 'exchange' in namespace 'std'
        tail{std::exchange(other.tail, nullptr)},
             ~~~~~^
./template.h:85:18: error: no member named 'exchange' in namespace 'std'
        len{std::exchange(other.len, 0)} {}
            ~~~~~^
./template.h:83:19: error: no member named 'exchange' in namespace 'std'
      : head{std::exchange(other.head, nullptr)},
             ~~~~~^
./template.h:91:17: error: no member named 'exchange' in namespace 'std'
    head = std::exchange(other.head, nullptr);
           ~~~~~^
./template.h:84:19: error: no member named 'exchange' in namespace 'std'
        tail{std::exchange(other.tail, nullptr)},
             ~~~~~^
./template.h:92:17: error: no member named 'exchange' in namespace 'std'
    tail = std::exchange(other.tail, nullptr);
           ~~~~~^
./template.h:85:18: error: no member named 'exchange' in namespace 'std'
        len{std::exchange(other.len, 0)} {}
            ~~~~~^
./template.h./template.h:93:16::91:17: error: no member named 'exchange' in namespace 'std'
    head = std::exchange(other.head, nullptr);
           ~~~~~^
 error: no member named 'exchange' in namespace 'std'
    len = std::exchange(other.len, 0);
          ~~~~~^
./template.h:92:17: error: no member named 'exchange' in namespace 'std'
    tail = std::exchange(other.tail, nullptr);
           ~~~~~^
./template.h:175:19: error: no member named 'make_unique' in namespace 'std'
  auto res = std::make_unique<char[]>(last - first + 1);
             ~~~~~^
./template.h:175:35: error: expected '(' for function-style cast or type construction
  auto res = std::make_unique<char[]>(last - first + 1);
                              ~~~~^
./template.h:93:16: error: no member named 'exchange' in namespace 'std'
    len = std::exchange(other.len, 0);
          ~~~~~^
./template.h:241:3: error: destructor cannot be marked constexpr
  constexpr ~ImmutableString() {
  ^
./template.h:247:30: warning: 'constexpr' non-static member function will not be implicitly 'const' in C++14; add 'const' to avoid a change in behavior [-Wconstexpr-not-const]
  constexpr ImmutableString &operator=(const ImmutableString &other) {
                             ^
                                                                     const
./template.h:258:30: warning: 'constexpr' non-static member function will not be implicitly 'const' in C++14; add 'const' to avoid a change in behavior [-Wconstexpr-not-const]
  constexpr ImmutableString &operator=(ImmutableString &&other) noexcept {
                             ^
                                                                const
./template.h:304:25: warning: 'constexpr' non-static member function will not be implicitly 'const' in C++14; add 'const' to avoid a change in behavior [-Wconstexpr-not-const]
  constexpr const char *copystr(InputIt first, InputIt last) {
                        ^
                                                             const
./template.h:230:22: error: constexpr constructor never produces a constant expression [-Winvalid-constexpr]
  constexpr explicit ImmutableString(const char *s)
                     ^
./template.h:231:13: note: non-constexpr function 'length' cannot be used in a constant expression
      : len(traits_type::length(s)), base(copystr(s, s + len)) {}
            ^
/Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/__string:217:5: note: declared here
    length(const char_type* __s)  _NOEXCEPT {return __builtin_strlen(__s);}
    ^
./template.h:175:19: error: no member named 'make_unique' in namespace 'std'
  auto res = std::make_unique<char[]>(last - first + 1);
             ~~~~~^
./template.h:175:35: error: expected '(' for function-style cast or type construction
  auto res = std::make_unique<char[]>(last - first + 1);
                              ~~~~^
In file included from http2.cc:25:
In file included from ./http2.h:40:
In file included from ./util.h:57:
./template.h:240:18: error: no member named 'exchange' in namespace 'std'
      : len{std::exchange(other.len, 0)}, base{std::exchange(other.base, "")} {}
            ~~~~~^
In file included from nghttp.cc:25:
In file included from ./nghttp.h:46:
/opt/local/include/ev.h:548:18: warning: mangled name of 'ev_set_allocator' will change in C++17 due to non-throwing exception specification in function signature [-Wc++17-compat-mangling]
EV_API_DECL void ev_set_allocator (void *(*cb)(void *ptr, long size) EV_NOEXCEPT) EV_NOEXCEPT;
                 ^
./template.h:241:3: error: /opt/local/include/ev.h:destructor cannot be marked constexpr554:18: warning: mangled name of 'ev_set_syserr_cb' will change in C++17 due to non-throwing exception specification in function signature [-Wc++17-compat-mangling]
EV_API_DECL void ev_set_syserr_cb (void (*cb)(const char *msg) EV_NOEXCEPT) EV_NOEXCEPT;
                 ^

  constexpr ~ImmutableString() {
  ^
./template.h:247:30: warning: 'constexpr' non-static member function will not be implicitly 'const' in C++14; add 'const' to avoid a change in behavior [-Wconstexpr-not-const]
  constexpr ImmutableString &operator=(const ImmutableString &other) {
                             ^
                                                                     const
/opt/local/include/ev.h:675:18: warning: mangled name of 'ev_set_loop_release_cb' will change in C++17 due to non-throwing exception specification in function signature [-Wc++17-compat-mangling]
EV_API_DECL void ev_set_loop_release_cb (EV_P_ void (*release)(EV_P) EV_NOEXCEPT, void (*acquire)(EV_P) EV_NOEXCEPT) EV_NOEXCEPT;
                 ^
./template.h:258:30: warning: 'constexpr' non-static member function will not be implicitly 'const' in C++14; add 'const' to avoid a change in behavior [-Wconstexpr-not-const]
  constexpr ImmutableString &operator=(ImmutableString &&other) noexcept {
                             ^
                                                                const
./template.h:304:25: warning: 'constexpr' non-static member function will not be implicitly 'const' in C++14; add 'const' to avoid a change in behavior [-Wconstexpr-not-const]
  constexpr const char *copystr(InputIt first, InputIt last) {
                        ^
                                                             const
./template.h:230:22: error: constexpr constructor never produces a constant expression [-Winvalid-constexpr]
  constexpr explicit ImmutableString(const char *s)
                     ^
./template.h:231:13: note: non-constexpr function 'length' cannot be used in a constant expression
      : len(traits_type::length(s)), base(copystr(s, s + len)) {}
            ^
/Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/__string:217:5: note: declared here
    length(const char_type* __s)  _NOEXCEPT {return __builtin_strlen(__s);}
    ^
./template.h:240:53: error: no member named 'exchange' in namespace 'std'
      : len{std::exchange(other.len, 0)}, base{std::exchange(other.base, "")} {}
                                               ~~~~~^
./template.h:239:13: error: constexpr constructor must initialize all members
  constexpr ImmutableString(ImmutableString &&other) noexcept
            ^
./template.h:313:13: note: member not initialized by constructor
  size_type len;
            ^
./template.h:314:15: note: member not initialized by constructor
  const char *base;
              ^
./template.h:249:14: error: binding value of type 'const nghttp2::ImmutableString' to reference to type 'nghttp2::ImmutableString' drops 'const' qualifier
      return *this;
             ^~~~~
./template.h:254:9: error: cannot assign to non-static data member within const member function 'operator='
    len = other.len;
    ~~~ ^
./template.h:247:30: note: member function 'nghttp2::ImmutableString::operator=' is declared const here
  constexpr ImmutableString &operator=(const ImmutableString &other) {
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./template.h:255:10: error: cannot assign to non-static data member within const member function 'operator='
    base = copystr(std::begin(other), std::end(other));
    ~~~~ ^
./template.h:247:30: note: member function 'nghttp2::ImmutableString::operator=' is declared const here
  constexpr ImmutableString &operator=(const ImmutableString &other) {
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./template.h:256:12: error: binding value of type 'const nghttp2::ImmutableString' to reference to type 'nghttp2::ImmutableString' drops 'const' qualifier
    return *this;
           ^~~~~
./template.h:248:5: warning: use of this statement in a constexpr function is a C++14 extension [-Wc++14-extensions]
    if (this == &other) {
    ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
In file included from util.cc:25:
In file included from ./util.h:57:
./template.h:240:18: error: no member named 'exchange' in namespace 'std'
      : len{std::exchange(other.len, 0)}, base{std::exchange(other.base, "")} {}
            ~~~~~^
./template.h:240:53: error: no member named 'exchange' in namespace 'std'
      : len{std::exchange(other.len, 0)}, base{std::exchange(other.base, "")} {}
                                               ~~~~~^
./template.h:239:13: error: constexpr constructor must initialize all members
  constexpr ImmutableString(ImmutableString &&other) noexcept
            ^
./template.h:313:13: note: member not initialized by constructor
  size_type len;
            ^
./template.h:314:15: note: member not initialized by constructor
  const char *base;
              ^
./template.h:249:14: error: binding value of type 'const nghttp2::ImmutableString' to reference to type 'nghttp2::ImmutableString' drops 'const' qualifier
      return *this;
             ^~~~~
./template.h:254:9: error: cannot assign to non-static data member within const member function 'operator='
    len = other.len;
    ~~~ ^
./template.h:247:30: note: member function 'nghttp2::ImmutableString::operator=' is declared const here
  constexpr ImmutableString &operator=(const ImmutableString &other) {
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./template.h:255:10: error: cannot assign to non-static data member within const member function 'operator='
    base = copystr(std::begin(other), std::end(other));
    ~~~~ ^
./template.h:247:30: note: member function 'nghttp2::ImmutableString::operator=' is declared const here
  constexpr ImmutableString &operator=(const ImmutableString &other) {
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./template.h:256:12: error: binding value of type 'const nghttp2::ImmutableString' to reference to type 'nghttp2::ImmutableString' drops 'const' qualifier
    return *this;
           ^~~~~
./template.h:248:5: warning: use of this statement in a constexpr function is a C++14 extension [-Wc++14-extensions]
    if (this == &other) {
    ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
7 warnings and 20 errors generated.
make[3]: *** [http2.o] Error 1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions