Unable to throw exceptions with ESP32 using Arduino framework

I’m trying to use C++ exceptions, but throwing an exception crashes the program.
In espressifs website they say that “Support for C++ Exceptions in ESP-IDF is disabled by default, but can be enabled using the CONFIG_COMPILER_CXX_EXCEPTIONS option.”

Here’s my platformio.ini:

platform = https://github.com/Jason2866/platform-espressif32.git#Arduino/IDF5
board = esp32doit-devkit-v1
framework = arduino
monitor_speed = 115200
build_flags = --std=c++20 -fexceptions
build_unflags = --std=gnu++11 --std=gnu++14 -fno-exceptions
lib_deps =

And here’s the program output on a crash:

abort() was called at PC 0x400e4cfb on core 1

Backtrace: 0x40082a91:0x3ffb1dc0 0x4008abe1:0x3ffb1de0 0x4008dbd9:0x3ffb1e00 0x400e4cfb:0x3ffb1e70 0x4012e6c5:0x3ffb1e90 0x400d19a1:0x3ffb1eb0 0x400d597a:0x3ffb1ed0 0x400d73ae:0x3ffb1fb0 0x400d761d:0x3ffb20b0 0x400d7683:0x3ffb2180 0x4013b28d:0x3ffb21d0 0x400d819d:0x3ffb21f0 0x400d362a:0x3ffb2240 0x400d7c5c:0x3ffb2270 0x400dcfb8:0x3ffb2290

ELF file SHA256: 0000000000000000

ets Jul 29 2019 12:21:46

rst:0xc (SW_CPU_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
mode:DIO, clock div:2
ho 8 tail 4 room 4
entry 0x40080570

Does it work with regular platform = espressif32@6.5.0? If yes, it’s a bug specific to that platform, go open an issue there.

And exceptions are actually default activated in the regular espressif platform + Arduino framework, so no need to even mess with build flags.