martinmoene / span-lite

span lite - A C++20-like span for C++98, C++11 and later in a single-file header-only library
Boost Software License 1.0
495 stars 40 forks source link

Wrong C++ version check for span_HAVE_NORETURN? #83

Closed simark closed 4 months ago

simark commented 5 months ago

Compiling as C++11, I see:

/home/smarchi/src/babeltrace/src/cpp-common/vendor/span-lite/span.hpp:831:1: error: function 'throw_out_of_range' could be declared with attribute 'noreturn' [-Werror,-Wmissing-noreturn]
  831 | {
      | ^
/home/smarchi/src/babeltrace/src/cpp-common/vendor/span-lite/span.hpp:854:1: error: function 'report_contract_violation' could be declared with attribute 'noreturn' [-Werror,-Wmissing-noreturn]
  854 | {
      | ^

The definition of span_HAVE_NORETURN is:

 #define span_HAVE_NORETURN                  span_CPP17_000

cppreference says it's available in C++11:

https://en.cppreference.com/w/cpp/language/attributes/noreturn

So I guess the definition of span_HAVE_RETURN should be span_CPP11_OR_GREATER or one of the span_CPP11_* ones. I have no idea about the support of MSVC for this, unfortunately.

eepp commented 5 months ago

@martinmoene Would you mind making a new release including this fix?

We include your projects directly into ours and I prefer referring to a specific version/tag.

martinmoene commented 5 months ago

@eepp Yeah, I'll do that, thanks for the heads-up.

martinmoene commented 5 months ago

@eepp Created release 0.11.0; notes yet to be edited.