I just tried to compile that code for an ESP32 and it worked flawlessly are you using the latest core for ESP32 ?-