Void Function Returning a Value

In tracktion_MidiList.cpp, line 491, the function is marked void, but returns an int.

void stopNote (MidiNote& note)
    {
        for (int ch = midiChannelBegin; ch < midiChannelEnd; ++ch)
            if (midiChannels[ch].notes.contains (&note))
                return midiChannels[ch].notes.removeFirstMatchingValue (&note);
        jassertfalse;
    }

It also needs to return a value on all paths. Perhaps like so…

int stopNote (MidiNote& note)
    {
        for (int ch = midiChannelBegin; ch < midiChannelEnd; ++ch)
            if (midiChannels[ch].notes.contains (&note))
                return midiChannels[ch].notes.removeFirstMatchingValue (&note);
        return(-1);
        jassertfalse;
    }

removeFirstMatchingValue doesn’t return a value does it? It returns void doesn’t it?

It returns the index of the removed item, or -1.

Where are you looking? notes is an juce::Array<MidiNote*>:

    /** Removes an item from the array.

        This will remove the first occurrence of the given element from the array.
        If the item isn't found, no action is taken.

        @param valueToRemove   the object to try to remove
        @see remove, removeRange, removeIf
    */
    void removeFirstMatchingValue (ParameterType valueToRemove)

Hmmm… that is an error I get when compiling with Visual Studio 2022, Tracktion:develop, JUCE:juce7.

Intellisense says that removeFirstMatchingValue returns the index of the item removed or -1.

Update: I just checked with the regular JUCE:develop, and the error goes away. So, removeFirstMatchingValue returns void under JUCE:develop.

The good news is that this is the only thing that has popped up as different between JUCE:juce7 and JUCE:develop.

Yep, looks like that’s changed in J7. We’ll update when it gets rolled to develop.

Got the same thing, J7 and tracktion engine master, I’m trying to find the right combination, no luck so far, what works for you?

edit : working combo → juce 6.16, and tracktion engine master branch as of today