Add support of c++17 standard
melg8 opened this issue · 3 comments
When changing in CMakeLists.txt cxx standard in cmake like this:
set(CMAKE_CXX_STANDARD
17)
And compiling with:
gcc (Ubuntu 8.1.0-5ubuntu1~16.04) 8.1.0
On latest devel commit
Observe an error in choice.hpp:55:
fast_ber/ber_types/Choice.hpp:55: error: ‘VisitResult’ in namespace ‘absl::variant_internal’ does not name a template type
absl::variant_internal::VisitResult<Visitor, Choice<Variants...>> visit(Visitor&& vis,
^~~~~~~~~~~
I think it happens because absl fallback to std implementation of visit and variant when c++17 is enabled (look for ABSL_USES_STD_VARIANT).
So basically variant_internal::VisitResult doesn't exists in that case.
I don't know best solution, but what i can suggest:
- replace (maybe conditionally?) visit return type with decltype(auto)
- fixup places, where visit returns ostream& - because it don't like copy construction, and you need calm rvalue and lvalue references errors.
Off topic: i think it will be great to add some checks to ci - to prevent any regression in standard support.
Thank you for the report. I'll take a look at this after work.
Adding coverage for more compilers is a great idea.
I've fixed the build for 17, and added g++-7 and clang++-7 to Travis.
Great! Thanks for fast response.