Closed AndWass closed 4 years ago
Thanks @AndWass ,
The problem is in the handling of the case where the C++20 standard header <span>
is available as with the following configuration it does compile:
-Dspan_CONFIG_SELECT_SPAN=span_SPAN_NONSTD -stdlib=libc++ -std=c++2a
The error only appears with libc++
, because only that library provides header <span>
apparently.
I'll look into it further.
@martinmoene I noticed the same error using clang(d)
10.0.0
[clang pp_expr_bad_token_lparen] [E] In included file: function-like macro 'span_HAVE' is not defined
My simple fix was to move line 281:
#define span_HAVE( feature ) ( span_HAVE_##feature )
to precede what I believe is its first use on line 32
# define span_CONFIG_SELECT_SPAN ( span_HAVE_STD_SPAN ? span_SPAN_STD : span_SPAN_NONSTD )
This gets rid of the error in clangd
and also compiles without any issue with
clang++ -stdlib=libc++ -std=c++2a -Wall sp_test.cpp
that contains #include <nonstd/span.hpp>
Can confirm that this fixed the issue for me as well
@AndWass thanks for bringing this to my attention, and @Arghnews much appreciated your solution which is now in head. Sorry for my delayed reaction.
Cheers, and thanks for the awesome library.
Thanks for the fix! Much appreciated :)
When trying to use your library with clang10 and libc++ and c++2a I get some compile errors for missing function-like macro span_HAVE. It works with clang9 and libc++ and c++2a though. Godbolt showcasing the issue (against 0.7.0, but errors also relevant on master branch): https://godbolt.org/z/yWWR6Z
Compile errors: