Warning with last VS 2017 related with Waveshaper

I have just updated Visual Studio 2017, and now when I compile something I got this warning :

c:\sdk\juce5\modules\juce_dsp\processors\juce_waveshaper.h(76): warning C4996: ‘std::result_of<_Fty>’: warning STL4014: std::result_of and std::result_of_t are deprecated in C++17. They are superseded by std::invoke_result and std::invoke_result_t. You can define _SILENCE_CXX17_RESULT_OF_DEPRECATION_WARNING or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning. (compiling source file …\JuceLibraryCode\include_juce_dsp.cpp)

I think it should be replaced with std::invoke_result :wink: (or maybe that define for C++17 should be enabled)

1 Like

Apparently, the last VS 2017 displays a lot of new warnings related with C++17, and the only way to make them diseappear is to use defines, or use the lastest C++ in the properties, but that’s quite annoying !

I had the same issue at work, actually. Even gets worse if you want to have nice features like the two pass compiler (/permissive-). Even gcc and clang are not as stringent when C++17 move is activated (they are still supported things that were removed in the standard).

But the worst part of this is that Visual Studio 2017 15.5+ is slow like hell, with freezes happening when you try to compile even the most simple JUCE app, when Intellisense is requesting something, I had to downgrade to 15.4 to be able to work without throwing my computer through the window :laughing:

Haven’t tried that part yet :confused:
Also from an industrial point of view, having compiler upgrades sometimes every week to fix regressions (15.6 to 15.6.1), leading to potential failures is not something that is sustainable.
But Intellisense is bad in general, I miss Visual Assist :frowning:

And since the beginning of March, they released 15.6.4 and 15.7 is coming out soon… Apparently the latter will fix VS slowness.

So for the moment I’m adding some defines in the VS2017 exporter properties such as _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to remove the warnings…

Hmm I don’t seem to get these warnings when building the demo runner (which uses the wavshaper) on the latest VS 2017 15.6.6.

Hello Fabian !

Sorry it seems that my report was incomplete. I did a few tests and I saw that it happens when the entry “C++ Language Standard” in the Projucer is either “C++17” or “Use latest”, but not with default value or C++14. Strangely enough, I saw this on a new project I created recently, and I don’t remember changing that value, maybe the last version of the Projucer I had set C++17 by default instead of C++14…

Indeed, all these warnings and errors come from C++17 dropping support for some C++03 “features”. And they started also deprecation more C++11 stuff that could be dropped in 2020, I think?
In that regard, they are closer to the standard than GCC which still ships with auto_ptr in C++17 mode.

OK I just fixed these warnings and they will appear on the public repo in a short while.


Hi Fabian,
This commit is causing compile errors in the JUCE develop branch with Xcode 9.3 /C++17 - it seems that std::invoke_result is not implemented in libc++ yet? (https://wg21.link/LWG2807)

Adding “&& JUCE_MSVC” to the preprocessor condition appears to fix it for me

template <typename Functor>
static WaveShaper<typename std::invoke_result<Functor>, Functor> CreateWaveShaper (Functor functionToUse)   { return {functionToUse}; }
template <typename Functor>
static WaveShaper<typename std::result_of<Functor>, Functor> CreateWaveShaper (Functor functionToUse)   { return {functionToUse}; }

OK I’ll push that change.