Skip to content

MakeSignal compilation error with Visual Studio 2017 using compiler flag /std:c++17 or /std:c++latest #24

@scottmcnab

Description

@scottmcnab

cpp.react fails to compile on Visual Studio 2017 15.5.7 when attempting to use the C++17 compiler. Specifically, any code that attempts to call MakeSignal() gives build errors.

For example, building a single file BasicAlgorithms.cpp (using ctrl-F7) gives this error when compiler flag /std::c++17 is enabled in the project properties (under C/C++ --> Language --> C++ Language Standard):

1>------ Build started: Project: Example_BasicAlgorithms, Configuration: Debug x64 ------
1>BasicAlgorithms.cpp
1>c:\git\rtvis\3rdparty\intel_tbb\include\tbb\task_group.h(113): error C4996: 'std::uncaught_exception': warning STL4006: std::uncaught_exception() is deprecated in C++17. It is superseded by std::uncaught_exceptions(), plural. You can define _SILENCE_CXX17_UNCAUGHT_EXCEPTION_DEPRECATION_WARNING or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.
1>c:\program files (x86)\microsoft visual studio\2017\professional\vc\tools\msvc\14.12.25827\include\exception(17): note: see declaration of 'std::uncaught_exception'
1>c:\git\cpp.react\include\react\detail\graph\algorithmnodes.h(371): error C2668: 'react::impl::apply': ambiguous call to overloaded function
1>c:\git\cpp.react\include\react\common\util.h(47): note: could be 'void react::impl::apply<react::impl::SyncedIterateByRefNode<D,S,E,react::impl::AddIterateByRefRangeWrapper<E,S,F,int>,int>::Tick::<lambda_fda7c352706d1102d1708ac0ea940db4>,std::tuple<std::shared_ptr>&>(F &&,T)'
1> with
1> [
1> D=example6::D,
1> S=std::vector<int,std::allocator>,
1> E=int,
1> TNode=react::impl::SignalNodeexample6::D,int,
1> F=react::impl::SyncedIterateByRefNode<example6::D,std::vector<int,std::allocator>,int,react::impl::AddIterateByRefRangeWrapper<int,std::vector<int,std::allocator>,F,int>,int>::Tick::<lambda_fda7c352706d1102d1708ac0ea940db4>,
1> T=std::tuple<std::shared_ptr<react::impl::SignalNodeexample6::D,int>> &
1> ]
1>c:\program files (x86)\microsoft visual studio\2017\professional\vc\tools\msvc\14.12.25827\include\tuple(1043): note: or 'decltype(auto) std::apply<react::impl::SyncedIterateByRefNode<D,S,E,react::impl::AddIterateByRefRangeWrapper<E,S,F,int>,int>::Tick::<lambda_fda7c352706d1102d1708ac0ea940db4>,std::tuple<std::shared_ptr>&>(_Callable &&,_Tuple)' [found using argument-dependent lookup]
1> with
1> [
1> D=example6::D,
1> S=std::vector<int,std::allocator>,
1> E=int,
1> TNode=react::impl::SignalNodeexample6::D,int,
1> _Callable=react::impl::SyncedIterateByRefNode<example6::D,std::vector<int,std::allocator>,int,react::impl::AddIterateByRefRangeWrapper<int,std::vector<int,std::allocator>,F,int>,int>::Tick::<lambda_fda7c352706d1102d1708ac0ea940db4>,
1> _Tuple=std::tuple<std::shared_ptr<react::impl::SignalNodeexample6::D,int>> &
1> ]
1>c:\git\cpp.react\include\react\detail\graph\algorithmnodes.h(355): note: while trying to match the argument list '(react::impl::SyncedIterateByRefNode<D,S,E,react::impl::AddIterateByRefRangeWrapper<E,S,F,int>,int>::Tick::<lambda_fda7c352706d1102d1708ac0ea940db4>, std::tuple<std::shared_ptr>)'
1> with
1> [
1> D=example6::D,
1> S=std::vector<int,std::allocator>,
1> E=int
1> ]
1> and
1> [
1> TNode=react::impl::SignalNodeexample6::D,int
1> ]
1>c:\git\cpp.react\include\react\detail\graph\algorithmnodes.h(355): note: while compiling class template member function 'void react::impl::SyncedIterateByRefNode<D,S,E,react::impl::AddIterateByRefRangeWrapper<E,S,F,int>,int>::Tick(void *)'
1> with
1> [
1> D=example6::D,
1> S=std::vector<int,std::allocator>,
1> E=int
1> ]
1>c:\program files (x86)\microsoft visual studio\2017\professional\vc\tools\msvc\14.12.25827\include\type_traits(517): note: see reference to class template instantiation 'react::impl::SyncedIterateByRefNode<D,S,E,react::impl::AddIterateByRefRangeWrapper<E,S,F,int>,int>' being compiled
1> with
1> [
1> D=example6::D,
1> S=std::vector<int,std::allocator>,
1> E=int
1> ]
1>c:\program files (x86)\microsoft visual studio\2017\professional\vc\tools\msvc\14.12.25827\include\memory(1284): note: see reference to class template instantiation 'std::is_convertible<_Yty *,_Ty *>' being compiled
1> with
1> [
1> _Yty=NodeT,
1> _Ty=react::impl::SignalNode<example6::D,std::vector<int,std::allocator>>
1> ]
1>c:\git\cpp.react\include\react\algorithm.h(145): note: see reference to class template instantiation 'std::_SP_pointer_compatible<NodeT,TNode>' being compiled
1> with
1> [
1> TNode=react::impl::SignalNode<example6::D,std::vector<int,std::allocator>>
1> ]
1>c:\git\cpp.react\examples\src\basicalgorithms.cpp(285): note: see reference to function template instantiation 'react::Signal<example6::D,std::vector<E,std::allocator<_Ty>>> react::Iterate<D,E,std::vector<_Ty,std::allocator<_Ty>>,example6::Sensor::<lambda_5beba5edb4fefc40f76e4dbbca2548f7>,S,std::vector<_Ty,std::allocator<_Ty>>>(const react::Events<D,E> &,V &&,const react::SignalPack<D,S> &,FIn &&)' being compiled
1> with
1> [
1> E=int,
1> _Ty=int,
1> D=example6::D,
1> S=int,
1> V=std::vector<int,std::allocator>,
1> FIn=example6::Sensor::<lambda_5beba5edb4fefc40f76e4dbbca2548f7>
1> ]
1>Done building project "Example_BasicAlgorithms.vcxproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

Note: this exact same file compiles cleanly when the compiler flag /std:c++14 is used instead:

1>------ Build started: Project: Example_BasicAlgorithms, Configuration: Debug x64 ------
1>BasicAlgorithms.cpp
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========

Do you know how to avoid this "ambiguous call to overloaded function" compiler error in C++17 mode?
Any pointers would be greatly appreciated.
Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions