A modern, C++-native, test framework for unit-tests, TDD and BDD - using C++14, C++17 and later (C++11 support is in v2.x branch, and C++03 on the Catch1.x branch)
From debugging the preprocessed code, it seems the co_await expression (line 2) inside __builtin_constant_p is being executed as well as the actual assertion (line 5). Is this looking like a compiler bug?
I believe this issue doesn't happen with Clang (mingw-w64).
Yep, that's a compiler bug. __builtin_constant_p is an unevaluated context, so the code inside should not be run (it should not even be compiled into the binary).
Describe the bug
If a
REQUIRE
assertion contains aco_await
expression, it may be executed twice.Expected behavior
The expression shouldn't run twice.
Reproduction steps
(I'd hope to present a small self-contained example but I don't have one for something that involves coroutines, so...)
pacman -S mingw-w64-ucrt-x86_64-toolchain mingw-w64-ucrt-x86_64-cmake mingw-w64-ucrt-x86_64-ninja git
Platform information:
Additional context
The problematic line is https://github.com/alvinhochun/cppwinrt/blob/20e5eb3a440a31913f294e5b4b3e759c830fe456/test/old_tests/UnitTests/async.cpp#L1572
The preprocessed code looks like this:
From debugging the preprocessed code, it seems the
co_await
expression (line 2) inside__builtin_constant_p
is being executed as well as the actual assertion (line 5). Is this looking like a compiler bug?I believe this issue doesn't happen with Clang (mingw-w64).