How to specify test cpp version(c++23)


I would like to use std::expected, which use c++23. So I use build_flag=-std=gnu++23.
When building normal app, it’s fine. But when testing, building stage failed, because of lack of expected file.

So, I just think the cpp version is not c++23.

My platformio.ini is like below

platform = espressif32
build_flags = -std=gnu++23
build_unflags = -std=gnu++11
board_build.partitions = partitions.csv
test_framework = googletest

test_framework = googletest
platform = native
test_ignore = test_embedded
build_type = test

How to correct it?

Any useful hints would be greatly appreciated.
Thank you.

Sorry but it was just because of my gcc version.
when I use g++-12, it works fine.