nvbench
nvbench copied to clipboard
compile nvbench_demo error when in c++20 (c++17 works well)
The steps to reproduce:
git clone https://github.com/NVIDIA/nvbench_demo
git submodule update --init --recursive
Modify CMakeLists.txt and use c++20.
cmake_minimum_required(VERSION 3.20.1)
project(NVBenchDemo CUDA CXX) # CXX added
add_subdirectory(nvbench)
add_executable(example_bench example_bench.cu)
target_compile_features(example_bench PUBLIC cxx_std_20) # new line
target_link_libraries(example_bench nvbench::main)
Then cmake -S. -Bbuild && cmake --build build. The output:
~/.mambaforge/envs/dev/x86_64-conda-linux-gnu/include/c++/12.3.0/variant(479): error: function "std::__detail::__variant::_Variadic_union<_First, _Rest...>::~_Variadic_unio
n() [with _First=nvbench::int64_t, _Rest=<nvbench::float64_t, std::string>]" (declared at line 400) cannot be referenced -- it is a deleted function
~_Variant_storage()
^
detected during:
instantiation of "std::__detail::__variant::_Variant_storage<false, _Types...>::~_Variant_storage() [with _Types=<nvbench::int64_t, nvbench::float64_t, std::string>]" at line 88
of ~/.mambaforge/envs/dev/x86_64-conda-linux-gnu/include/c++/12.3.0/bits/stl_construct.h
implicit generation of "std::__detail::__variant::_Copy_ctor_base<<unnamed>, _Types...>::~_Copy_ctor_base() noexcept [with <unnamed>=false, _Types=<nvbench::int64_t, nvbench::flo
at64_t, std::string>]" at line 88 of ~/.mambaforge/envs/dev/x86_64-conda-linux-gnu/include/c++/12.3.0/bits/stl_construct.h
instantiation of class "std::__detail::__variant::_Copy_ctor_base<<unnamed>, _Types...> [with <unnamed>=false, _Types=<nvbench::int64_t, nvbench::float64_t, std::string>]" at lin
e 88 of ~/.mambaforge/envs/dev/x86_64-conda-linux-gnu/include/c++/12.3.0/bits/stl_construct.h
implicit generation of "std::__detail::__variant::_Move_ctor_base<<unnamed>, _Types...>::~_Move_ctor_base() noexcept [with <unnamed>=false, _Types=<nvbench::int64_t, nvbench::flo
at64_t, std::string>]" at line 88 of ~/.mambaforge/envs/dev/x86_64-conda-linux-gnu/include/c++/12.3.0/bits/stl_construct.h
instantiation of class "std::__detail::__variant::_Move_ctor_base<<unnamed>, _Types...> [with <unnamed>=false, _Types=<nvbench::int64_t, nvbench::float64_t, std::string>]" at lin
e 88 of ~/.mambaforge/envs/dev/x86_64-conda-linux-gnu/include/c++/12.3.0/bits/stl_construct.h
[ 10 instantiation contexts not shown ]
instantiation of "void std::_Destroy_aux<<unnamed>>::__destroy(_ForwardIterator, _ForwardIterator) [with <unnamed>=false, _ForwardIterator=nvbench::named_values::named_value *]"
at line 193 of ~/.mambaforge/envs/dev/x86_64-conda-linux-gnu/include/c++/12.3.0/bits/stl_construct.h
instantiation of "void std::_Destroy(_ForwardIterator, _ForwardIterator) [with _ForwardIterator=nvbench::named_values::named_value *]" at line 850 of ~/.mambafo
rge/envs/dev/x86_64-conda-linux-gnu/include/c++/12.3.0/bits/alloc_traits.h
instantiation of "void std::_Destroy(_ForwardIterator, _ForwardIterator, std::allocator<_Tp> &) [with _ForwardIterator=nvbench::named_values::named_value *, _Tp=nvbench::named_va
lues::named_value]" at line 731 of ~/.mambaforge/envs/dev/x86_64-conda-linux-gnu/include/c++/12.3.0/bits/stl_vector.h
instantiation of "std::vector<_Tp, _Alloc>::~vector() noexcept [with _Tp=nvbench::named_values::named_value, _Alloc=std::allocator<nvbench::named_values::named_value>]" at line 7
4 of ~/nvbench_demo/nvbench/nvbench/summary.cuh
implicit generation of "nvbench::named_values::named_values() noexcept" at line 74 of ~/nvbench_demo/nvbench/nvbench/summary.cuh
I suspect it's a gcc bug, as std::variant fails with int, float, std::string.