I got an issue with clang4 and clang7. clang 6 works. clang5 not tested.
1) cmake-3.12.2-gcc-5.4.0-raqsion
2) boost-1.65.1-gcc-5.4.0-5ovw2kd # same with boost1.68.0
4) llvm-4.0.0-gcc-5.4.0-aphw7nd # same with llvm-7.0.0
clang4
[100%] Building NVCC (Device) object example/helloWorld/CMakeFiles/helloWorld.dir/src/helloWorld_generated_helloWorld.cpp.o
/opt/spack-modules/linux-ubuntu16.04-x86_64/gcc-5.4.0/llvm-4.0.0-aphw7ndgbitrr2bi3w3zlxgyudtcjkfx/bin/../include/c++/v1/memory:3813:7: error: exception specification of overriding function is more lax than base version
class __shared_ptr_emplace : public __shared_weak_count {
^
/opt/spack-modules/linux-ubuntu16.04-x86_64/gcc-5.4.0/llvm-4.0.0-aphw7ndgbitrr2bi3w3zlxgyudtcjkfx/bin/../include/c++/v1/memory:4444:25: note: in instantiation of template class 'std::__1::__shared_ptr_emplace<alpaka::queue::cpu::detail::QueueCpuAsyncImpl, std::__1::allocator<alpaka::queue::cpu::detail::QueueCpuAsyncImpl> >' requested here
::new ((__hold2.get())) _CntrlBlk(__a2, __1::forward< _Args> (__args)...);
^
/opt/spack-modules/linux-ubuntu16.04-x86_64/gcc-5.4.0/llvm-4.0.0-aphw7ndgbitrr2bi3w3zlxgyudtcjkfx/bin/../include/c++/v1/memory:4810:27: note: in instantiation of function template specialization 'std::__1::shared_ptr<alpaka::queue::cpu::detail::QueueCpuAsyncImpl>::make_shared<const alpaka::dev::DevCpu &>' requested here
return shared_ptr< _Tp> ::make_shared(__1::forward< _Args> (__args)...);
^
/home/mwerner/cuda-workspace/alpaka/include/alpaka/queue/QueueCpuAsync.hpp:104:27: note: in instantiation of function template specialization 'std::__1::make_shared<alpaka::queue::cpu::detail::QueueCpuAsyncImpl, const alpaka::dev::DevCpu &>' requested here
dev) : m_spQueueImpl(std::make_shared< cpu::detail::QueueCpuAsyncImpl> (dev))
^
/opt/spack-modules/linux-ubuntu16.04-x86_64/gcc-5.4.0/llvm-4.0.0-aphw7ndgbitrr2bi3w3zlxgyudtcjkfx/bin/../include/c++/v1/memory:3739:20: note: overridden virtual function is here
protected: virtual ~__shared_weak_count();
clang7
In file included from /home/mwerner/cuda-workspace/alpaka/example/helloWorld/src/helloWorld.cpp:23:
In file included from /home/mwerner/cuda-workspace/alpaka/include/alpaka/alpaka.hpp:33:
In file included from /home/mwerner/cuda-workspace/alpaka/include/alpaka/acc/AccCpuSerial.hpp:27:
In file included from /home/mwerner/cuda-workspace/alpaka/include/alpaka/workdiv/WorkDivMembers.hpp:24:
In file included from /home/mwerner/cuda-workspace/alpaka/include/alpaka/workdiv/Traits.hpp:28:
In file included from /home/mwerner/cuda-workspace/alpaka/include/alpaka/vec/Vec.hpp:24:
In file included from /home/mwerner/cuda-workspace/alpaka/include/alpaka/vec/Traits.hpp:25:
In file included from /home/mwerner/cuda-workspace/alpaka/include/alpaka/extent/Traits.hpp:24:
In file included from /home/mwerner/cuda-workspace/alpaka/include/alpaka/core/Common.hpp:25:
In file included from /home/mwerner/cuda-workspace/alpaka/include/alpaka/core/Debug.hpp:28:
In file included from /opt/spack-modules/linux-ubuntu16.04-x86_64/gcc-5.4.0/llvm-7.0.0-yzj33hvkpdvzfmkx6jlwuoxtoaqkzs43/bin/../include/c++/v1/string:500:
In file included from /opt/spack-modules/linux-ubuntu16.04-x86_64/gcc-5.4.0/llvm-7.0.0-yzj33hvkpdvzfmkx6jlwuoxtoaqkzs43/bin/../include/c++/v1/string_view:176:
In file included from /opt/spack-modules/linux-ubuntu16.04-x86_64/gcc-5.4.0/llvm-7.0.0-yzj33hvkpdvzfmkx6jlwuoxtoaqkzs43/bin/../include/c++/v1/__string:56:
In file included from /opt/spack-modules/linux-ubuntu16.04-x86_64/gcc-5.4.0/llvm-7.0.0-yzj33hvkpdvzfmkx6jlwuoxtoaqkzs43/bin/../include/c++/v1/algorithm:644:
/opt/spack-modules/linux-ubuntu16.04-x86_64/gcc-5.4.0/llvm-7.0.0-yzj33hvkpdvzfmkx6jlwuoxtoaqkzs43/bin/../include/c++/v1/memory:3640:7: error: exception specification of overriding function is more lax than base version
class __shared_ptr_emplace
^
/opt/spack-modules/linux-ubuntu16.04-x86_64/gcc-5.4.0/llvm-7.0.0-yzj33hvkpdvzfmkx6jlwuoxtoaqkzs43/bin/../include/c++/v1/memory:4313:26: note: in instantiation of template class
'std::__1::__shared_ptr_emplace<alpaka::queue::cpu::detail::QueueCpuAsyncImpl, std::__1::allocator<alpaka::queue::cpu::detail::QueueCpuAsyncImpl> >' requested here
::new(__hold2.get()) _CntrlBlk(__a2, _VSTD::forward<_Args>(__args)...);
^
/opt/spack-modules/linux-ubuntu16.04-x86_64/gcc-5.4.0/llvm-7.0.0-yzj33hvkpdvzfmkx6jlwuoxtoaqkzs43/bin/../include/c++/v1/memory:4692:29: note: in instantiation of function template specialization
'std::__1::shared_ptr<alpaka::queue::cpu::detail::QueueCpuAsyncImpl>::make_shared<const alpaka::dev::DevCpu &>' requested here
return shared_ptr<_Tp>::make_shared(_VSTD::forward<_Args>(__args)...);
^
/home/mwerner/cuda-workspace/alpaka/include/alpaka/queue/QueueCpuAsync.hpp:105:40: note: in instantiation of function template specialization 'std::__1::make_shared<alpaka::queue::cpu::detail::QueueCpuAsyncImpl, const alpaka::dev::DevCpu
&>' requested here
m_spQueueImpl(std::make_shared<cpu::detail::QueueCpuAsyncImpl>(dev))
^
/opt/spack-modules/linux-ubuntu16.04-x86_64/gcc-5.4.0/llvm-7.0.0-yzj33hvkpdvzfmkx6jlwuoxtoaqkzs43/bin/../include/c++/v1/memory:3549:13: note: overridden virtual function is here
virtual ~__shared_weak_count();
^
1 error generated.
cmake
cmake
-DALPAKA_ACC_CPU_B_SEQ_T_THREADS_ENABLE=OFF
-DALPAKA_ACC_CPU_B_SEQ_T_FIBERS_ENABLE=OFF
-DALPAKA_ACC_CPU_B_TBB_T_SEQ_ENABLE=OFF
-DALPAKA_ACC_CPU_B_OMP2_T_SEQ_ENABLE=OFF
-DALPAKA_ACC_CPU_B_SEQ_T_OMP2_ENABLE=ON
-DALPAKA_ACC_CPU_BT_OMP4_ENABLE=OFF
make helloWorld
Not sure why the QueueCpuAsyncImpldestructor is throwing (guess must be a serious reason for such atrocity), but maybe then the code is allowed to not compile.
Some info on the topic:
https://stackoverflow.com/questions/19528691/why-do-the-std-smart-pointer-type-destructors-not-inherit-the-noexcept-dtor-stat
https://bugs.llvm.org/show_bug.cgi?id=32978
https://stackoverflow.com/a/43907314
Btw in case the destructor has to be throwing and clang correctly does not process it, here is a workaround: https://github.com/capnproto/capnproto/issues/553
thanks for collecting the material, have not checked into it yet, but do you see, what can be done on our side to resolve this problem? I do not understand, why only "my" versions of clang4 and clang7 have this issue.
I think this is not only your clang. E.g., on godbolt all three versions do not compile it: https://godbolt.org/z/5i0OIR
As far as I understand the author of one of the answers I linked also submitted that bug but then it was decided the Standard permits such behavior, so it is not a bug; at least it was not fixed then and is currently present in trunk.
@BenjaminW3 , @psychocoderHPC is the throwing destructor such a necessary measure here?
ah ok interesting. On travis it seems to work.
For the record, here is the minimal code from above to produce the error, copied from @sbastrakov's godbolt link:
#include <iostream>
#include <memory>
#include <string>
struct Foo {
~Foo() noexcept(false) {} // this gives compile error with make_shared
//~Foo() {} // this does not
};
int main(int argc, char** argv)
{
// this works for both throwing and non-throwing
std::shared_ptr<Foo> foo;
// this works only for non-throwing
foo = std::make_shared<Foo>();
return 0;
}
It is compiling in CI but not on your clang... The only difference I see is the standard library that is used. In CI we are installing libstdc++-5-dev but I do not know if we use it at all.
We may want to add a try-catchin ~QueueCpuAsyncImpl() and remove the noexcept(false). I will have a look at it if I find some time.
@BenjaminW3 I don't see how would a function-try-block help for the destructor, as it automatically rethrows at the end. Edit: I think so based on the "Reaching the end of a catch clause..." paragraph here
Offtop, but fun: the following code crashes ~the trunk version of clang~ (edit: it was not nearly the latest version, got confused by the interface) on godbolt, other versions work:
int main()
{
throw;
}
related to #468