diff --git a/modules/juce_core/maths/juce_MathsFunctions.h b/modules/juce_core/maths/juce_MathsFunctions.h index d673693fc1..a86edfb4ae 100644 --- a/modules/juce_core/maths/juce_MathsFunctions.h +++ b/modules/juce_core/maths/juce_MathsFunctions.h @@ -297,12 +297,7 @@ void ignoreUnused (Types&&...) noexcept {} @endcode */ template -int numElementsInArray (Type (&array)[N]) -{ - (void) array; - (void) sizeof (0[array]); // This line should cause an error if you pass an object with a user-defined subscript operator - return N; -} +JUCE_CONSTEXPR int numElementsInArray (Type (&)[N]) noexcept { return N; } //============================================================================== // Some useful maths functions that aren't always present with all compilers and build settings.