Possible to use C++20 for ESP32 with Arduino framework

I would like to use C++20, especially concepts when developing for ESP32 with Arduino framework, but I haven’t got it to compile. I tried with plain idf.py and it worked and as espressif says in their docs " By default, ESP-IDF compiles C++ code with C++23 language standard with GNU extensions (-std=gnu++23).".

So I’m wondering why it’s not working with platformio? I have just updated platformio so the compilers it provides should be up to date. Also the arduino framework shouldn’t be the limiting factor of c++ standard, since standard are backward compatible.

You can enable c++20 support by


However, this does not change the fact that Espressif’s xtensa-esp32-toolchain is missing the concepts header file :cry:

Consepts are available by default if I use esp-idf as the framework in platformio. Why is that? Why using arduino framework limits the compiler version?

Compiling with framework=arduino the toolchain used is toolchain-xtensa-esp32 @ 8.4.0+2021r2-patch5
Compiling with framework=esp-idf the toolchain used is toolchain-xtensa-esp32 @ 12.2.0+20230208

So when using arduino framework platformio chooses to use older compiler version. Do you know if it’s possible to force specific compiler version?

Espressif is currently working on Arduino version 3.0.
This will then be based on ESP-IDF 5.x and therefore also use the newer tool chain.

1 Like

You can get the 12.2.0 toolchain and Arduino-ESP32 3.x by using Jason’s platform fork.


1 Like