Build warnings on Windows 10, VS 2019

I am getting the following warnings that appear to be related to juce_FocusTraverser.cpp and I am somewhat at a loss.

Well, ok, I am lost but would like to understand. I think this is tell me that I am making the compiler look for something that does not exists or perhaps compare something against nothing.

Has anyone else seen this and know where I might begin to understand it?

Using Windows 10, VS 2019, current develop branch of JUCE. I don’t see the same using xcode.

In file included from ../JUCE/modules/juce_gui_basics/juce_gui_basics.cpp:130:
../JUCE/modules/juce_gui_basics/components/juce_FocusTraverser.cpp:61:52: warning: zero as null pointer constant [-Wzero-as-null-pointer-constant]
            return getComponentOrderAttributes (a) < getComponentOrderAttributes (b);
                                                   ^
                                                   nullptr
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30037\include\tuple:759:97: note: while rewriting comparison as call to 'operator<=>' declared here      
_NODISCARD constexpr common_comparison_category_t<_Synth_three_way_result<_Types1, _Types2>...> operator<=>(
                                                                                                ^
../JUCE/modules/juce_gui_basics/components/juce_FocusTraverser.cpp:141:23: note: in instantiation of function template specialization 'juce::FocusHelpers::findAllComponents<bool (juce::Component::*)() const noexcept>' requested here
        FocusHelpers::findAllComponents (parentComponent,
                      ^
1 warning generated.
[159/162] Building CXX object plug-Example-syn/plug/CMakeFiles/plug-Example-syn_tests.dir/Debug/__/__/JUCE/modules/juce_gui_basics/juce_gui_basics.cpp.obj
In file included from ../JUCE/modules/juce_gui_basics/juce_gui_basics.cpp:130:
../JUCE/modules/juce_gui_basics/components/juce_FocusTraverser.cpp:61:52: warning: zero as null pointer constant [-Wzero-as-null-pointer-constant]
            return getComponentOrderAttributes (a) < getComponentOrderAttributes (b);
                                                   ^
                                                   nullptr
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30037\include\tuple:759:97: note: while rewriting comparison as call to 'operator<=>' declared here      
_NODISCARD constexpr common_comparison_category_t<_Synth_three_way_result<_Types1, _Types2>...> operator<=>(
                                                                                                ^
../JUCE/modules/juce_gui_basics/components/juce_FocusTraverser.cpp:141:23: note: in instantiation of function template specialization 'juce::FocusHelpers::findAllComponents<bool (juce::Component::*)() const noexcept>' requested here
        FocusHelpers::findAllComponents (parentComponent,
                      ^
1 warning generated.

Do you see these warnings when building an unmodified DemoRunner project from the latest develop with VS2019? I’m unable to reproduce them on my machine. It looks like it’s occurring when trying to add a default spaceship operator which is a C++20 feature, have you changed the language standard?

Hi @ed95,

It is part of CI build, so I was using cmake with ninja, setting the c++ version like set(CMAKE_CXX_STANDARD 17) and building with cmake --build _builds.

With set(CMAKE_CXX_STANDARD 20), I get the same warnings.

These errors do not show when building DemoRunner with vs2019. They also do not show when building on mac or linux. I checked all three with the latest JUCE develop branch.

I’m still not able to reproduce this. I’ve tried using the CMake Ninja generator to build the DemoRunner with the C++ standard set to both C++17 and C++20. Can you post the exact build command that you are using?

I can’t see anything wrong with that bit of code though, it looks to me like it might be a bug with MSVC’s generated spaceship operator comparing iterators.