proxy-wasm-cpp-host
proxy-wasm-cpp-host copied to clipboard
build: Compile with C++20
std=c++20 is used by both v8 and Envoy. Switching to use it overall will reduce build surprises when importing proxy-wasm-cpp-host into Envoy.
Windows and MacOS presubmits fail with:
In file included from external/com_google_googletest/googlemock/include/gmock/gmock.h:59:
external/com_google_googletest/googlemock/include/gmock/gmock-actions.h:819:36: error: no type named 'result_of' in namespace 'std'
using ReturnType = typename std::result_of<MethodPtr(Class*)>::type;
~~~~~~~~~~~~~~^~~~~~~~~
external/com_google_googletest/googlemock/include/gmock/gmock-actions.h:819:45: error: expected ';' after alias declaration
using ReturnType = typename std::result_of<MethodPtr(Class*)>::type;
This should be fixable by upgrading to a more recent version of googletest: https://github.com/google/googletest/issues/2914
Repro of g++-specific compile error with variadic templates, which compiles successfully with -std=c++17 but not with -std=c++20: https://godbolt.org/z/TT9a9YPf7
Repro of g++-specific compile error with variadic templates, which compiles successfully with -std=c++17 but not with -std=c++20: https://godbolt.org/z/TT9a9YPf7
Changing this constructor declaration from:
Counter<Tags...>(std::string_view name, MetricTagDescriptor<Tags>... descriptors)
to:
Counter(std::string_view name, MetricTagDescriptor<Tags>... descriptors)
appears to appease gcc-12, and works with clang as well. Hooray for godbolt.
clang-tidy failure may be https://github.com/llvm/llvm-project/issues/56709
Repro of g++-specific compile error with variadic templates, which compiles successfully with -std=c++17 but not with -std=c++20: https://godbolt.org/z/TT9a9YPf7
Changing this constructor declaration [...] appears to appease gcc-12, and works with clang as well. Hooray for godbolt.
Looks like the issue was this. I'll put it in a PR for proxy-wasm-cpp-sdk tomorrow.
Repro of g++-specific compile error with variadic templates, which compiles successfully with -std=c++17 but not with -std=c++20: https://godbolt.org/z/TT9a9YPf7
Changing this constructor declaration from:
Counter<Tags...>(std::string_view name, MetricTagDescriptor<Tags>... descriptors)to:
Counter(std::string_view name, MetricTagDescriptor<Tags>... descriptors)appears to appease gcc-12, and works with clang as well. Hooray for godbolt.
I distinctly remember we had to appeal this way in envoy - there might be a patch there already.
I distinctly remember we had to appeal this way in envoy - there might be a patch there already.
Indeed! https://github.com/envoyproxy/envoy/blob/6648db236f64218611f36e91285716c8bec67abb/bazel/proxy_wasm_cpp_sdk.patch
The only remaining CI failure is due to clang-tidy itself crashing, which I hope is transient. So I think this is ready for review, @martijneken and/or @PiotrSikora. Thanks!
This PR is obsoleted by #439.