SPI without MOSI on STM32F4 asserts at runtime

The documentation for mbed 5.15 states that the SPI constructor can take NC for the MOSI or MISO pin if it is not used. This compiles fine, but it generates a runtime assert:

Error Message: Assertion failed: pin != (PinName)NC
File: …/mbed-os\targets\TARGET_STM\pinmap.c+62

because the spi_init_direct function in stm_spi_api calls pin_function() at line 172 with the PinName before it checks whether it is NC or not in line 201.

Is there a known work around for this?

I think this is corrected on mbed-os-6 branch, since