aboutsummaryrefslogtreecommitdiff
path: root/libstdc++-v3/testsuite/std
diff options
context:
space:
mode:
authorJonathan Wakely <jwakely@redhat.com>2025-05-15 11:01:05 +0100
committerJonathan Wakely <redi@gcc.gnu.org>2025-05-15 16:33:57 +0100
commitc65725eccbabf3b9b5965f27fff2d3b9f6c75930 (patch)
tree7dd6b0f563a2ce8df3e1b0b1a71193a024a9a2d6 /libstdc++-v3/testsuite/std
parent270d23c5b201c8e000f60e05d17577498f409441 (diff)
downloadgcc-c65725eccbabf3b9b5965f27fff2d3b9f6c75930.zip
gcc-c65725eccbabf3b9b5965f27fff2d3b9f6c75930.tar.gz
gcc-c65725eccbabf3b9b5965f27fff2d3b9f6c75930.tar.bz2
libstdc++: Fix std::format_kind primary template for Clang [PR120190]
Although Clang trunk has been adjusted to handle our std::format_kind definition (because they need to be able to compile the GCC 15.1.0 release), it's probably better to not rely on something that they might start diagnosing again in future. Define the primary template in terms of an immediately invoked function expression, so that we can put a static_assert(false) in the body. libstdc++-v3/ChangeLog: PR libstdc++/120190 * include/std/format (format_kind): Adjust primary template to not depend on itself. * testsuite/std/format/ranges/format_kind_neg.cc: Adjust expected errors. Check more invalid specializations. Reviewed-by: Tomasz Kamiński <tkaminsk@redhat.com> Reviewed-by: Daniel Krügler <daniel.kruegler@gmail.com>
Diffstat (limited to 'libstdc++-v3/testsuite/std')
-rw-r--r--libstdc++-v3/testsuite/std/format/ranges/format_kind_neg.cc15
1 files changed, 10 insertions, 5 deletions
diff --git a/libstdc++-v3/testsuite/std/format/ranges/format_kind_neg.cc b/libstdc++-v3/testsuite/std/format/ranges/format_kind_neg.cc
index bf8619d..0d761ae 100644
--- a/libstdc++-v3/testsuite/std/format/ranges/format_kind_neg.cc
+++ b/libstdc++-v3/testsuite/std/format/ranges/format_kind_neg.cc
@@ -5,9 +5,14 @@
#include <format>
-template<auto> struct Tester { };
+void test()
+{
+ (void) std::format_kind<void>; // { dg-error "here" }
+ (void) std::format_kind<const void>; // { dg-error "here" }
+ (void) std::format_kind<int>; // { dg-error "here" }
+ (void) std::format_kind<int&>; // { dg-error "here" }
+ (void) std::format_kind<const int(&)[10]>; // { dg-error "here" }
+ (void) std::format_kind<void()>; // { dg-error "here" }
+}
-Tester<std::format_kind<const int(&)[1]>> t; // { dg-error "here" }
-
-// { dg-error "use of 'std::format_kind" "" { target *-*-* } 0 }
-// { dg-error "primary_template_not_defined" "" { target *-*-* } 0 }
+// { dg-error "cannot use primary template of 'std::format_kind'" "" { target *-*-* } 0 }