From 909d18c29145edef4fdd0e1aeb07dfce11c1c9f9 Mon Sep 17 00:00:00 2001 From: Patrick Palka Date: Wed, 11 Mar 2026 10:00:57 -0400 Subject: [PATCH] c++: add fixed test [PR124389] This one is also fixed by r16-7055. The testcases from that commit utilize the concepts satisfaction cache, whereas this one utilizes the constexpr call cache. PR c++/124389 PR c++/122494 gcc/testsuite/ChangeLog: * g++.dg/cpp0x/static_assert18.C: New test. --- gcc/testsuite/g++.dg/cpp0x/static_assert18.C | 28 ++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 gcc/testsuite/g++.dg/cpp0x/static_assert18.C diff --git a/gcc/testsuite/g++.dg/cpp0x/static_assert18.C b/gcc/testsuite/g++.dg/cpp0x/static_assert18.C new file mode 100644 index 00000000000..d38dbf40781 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/static_assert18.C @@ -0,0 +1,28 @@ +// PR c++/124389 +// { dg-do compile { target c++11 } } + +template struct Empty {}; + +template +constexpr bool test(T) noexcept { return true; } + +template +struct always_true { + static constexpr bool value = true; + static_assert(test(Empty{}), "BUG"); +}; + +template +struct AAA { + template ::value> + AAA(U) {} +}; + +template )> +void test_function() { + auto r = U(AAA(1)); +} + +int main() { + return 0; +}