← All tasks
cppocornut/imgui #9432Not a task: not reproduced

Dawn examples require C++20 compiler

envgap__ocornut__imgui-9432

01 / FAILURE SIGNATURE

As reported upstream

/home/owd/Documents/imgui/examples/example_glfw_wgpu/dawn/gen/include/dawn/webgpu_cpp.h:4328:21: error: no template named 'type_identity' in namespace 'std'; did you mean '__type_identity'?
Not a benchmark task.
  • In a clean container the reported failure did not reproduce, or the known fix did not make the project run.

02 / ENVIRONMENT RECIPE

Base commit
6acba3b47d2ac4c7bb5ffb6ab04bcd896b3d3658
Manifest
examples/example_glfw_wgpu/CMakeLists.txt
Reproduce
Awaiting issue-specific recipe
Run under trace
Awaiting a meaningful runtime command

03 / ORIGINAL ISSUE TEXT

ocornut/imgui #9432 · read the original issue
### Version/Branch of Dear ImGui:

Version 1.92.8, Branch: master

### Back-ends:

imgui_impl_wgpu.cpp

### Compiler, OS:

Linux + Clang 21.1.8 (6ubuntu1)

### Full config/build information:

_No response_

### Details:

**My Issue/Question:**

Since 18th April 2025, Google's WebGPU implementation _Dawn_ requires a C++20 compiler.  The change can be seen here: https://github.com/google/dawn/commit/32c8fdb708ef1f074fad902247e1280f9aa2eb8b

Three _Dear ImGui_ examples build Dawn in the project directory:

- https://github.com/ocornut/imgui/tree/master/examples/example_glfw_wgpu
- https://github.com/ocornut/imgui/tree/master/examples/example_sdl2_wgpu
- https://github.com/ocornut/imgui/tree/master/examples/example_sdl3_wgpu

In each case, `dawn/webgpu_cpp.h` (generated at build-time) fails to build due to use of C++20 features, where the `CMakeLists.txt` sets `CMAKE_CXX_STANDARD` to `17`.

Sample of build errors:

```
/home/owd/Documents/imgui/examples/example_glfw_wgpu/dawn/gen/include/dawn/webgpu_cpp.h:4327:47: warning: explicit template parameter list for lambdas is a C++20 extension [-Wc++20-extensions]
 4327 |     using BaseArgsTuple = typename decltype([]<std::size_t... Is>(std::index_sequence<Is...>) {
      |                                               ^
/home/owd/Documents/imgui/examples/example_glfw_wgpu/dawn/gen/include/dawn/webgpu_cpp.h:4328:21: error: no template named 'type_identity' in namespace 'std'; did you mean '__type_identity'?
 4328 |         return std::type_identity<std::tuple<std::tuple_element_t<Is, std::tuple<CppArgs...>>...>>{};
      |                ~~~~~^~~~~~~~~~~~~
      |                     __type_identity
/usr/lib/gcc/x86_64-linux-gnu/15/../../../../include/c++/15/type_traits:167:12: note: '__type_identity' declared here
  167 |     struct __type_identity
      |            ^
In file included from /home/owd/Documents/imgui/examples/example_glfw_wgpu/main.cpp:27:
In file included from /home/owd/Documents/webcfd/dawn/include/webgpu/webgpu_cpp.h:31:
/home/owd/Documents/imgui/examples/example_glfw_wgpu/dawn/gen/include/dawn/webgpu_cpp.h:4340:47: warning: explicit template parameter list for lambdas is a C++20 extension [-Wc++20-extensions]
 4340 |     using BaseArgsTuple = typename decltype([]<std::size_t... Is>(std::index_sequence<Is...>) {
      |                                               ^
/home/owd/Documents/imgui/examples/example_glfw_wgpu/dawn/gen/include/dawn/webgpu_cpp.h:4341:21: error: no template named 'type_identity' in namespace 'std'; did you mean '__type_identity'?
 4341 |         return std::type_identity<std::tuple<std::tuple_element_t<Is, std::tuple<CppArgs...>>...>>{};
      |                ~~~~~^~~~~~~~~~~~~
      |                     __type_identity
/usr/lib/gcc/x86_64-linux-gnu/15/../../../../include/c++/15/type_traits:167:12: note: '__type_identity' declared here
  167 |     struct __type_identity
      |            ^
```

Therefore, in each of the WebGPU examples which rely on Dawn, `CMAKE_CXX_STANDARD` should be set to at least `20`.

### Screenshots/Video:

_No response_

### Minimal, Complete and Verifiable Example code:

_No response_
Continue on GitHub ↗

04 / LABELS

Labels from the report text only; not yet run

No supported category has been assigned.

Label rules and the text that matched
[]