diff mbox series

[pushed] c++: add fixed test [PR100557]

Message ID 20240326144419.25277-1-polacek@redhat.com
State New
Headers show
Series [pushed] c++: add fixed test [PR100557] | expand

Commit Message

Marek Polacek March 26, 2024, 2:44 p.m. UTC
Tested x86_64-pc-linux-gnu, applying to trunk.

-- >8 --
We used to hit the "Error reporting routines re-entered." ICE here but
it was fixed by Patrick's r14-3809.

	PR c++/100557

gcc/testsuite/ChangeLog:

	* g++.dg/cpp2a/concepts-pr100557.C: New test.
---
 .../g++.dg/cpp2a/concepts-pr100557.C          | 21 +++++++++++++++++++
 1 file changed, 21 insertions(+)
 create mode 100644 gcc/testsuite/g++.dg/cpp2a/concepts-pr100557.C


base-commit: 2f47ca046eecf8f2fcae23df3ccee44d943ef512
diff mbox series

Patch

diff --git a/gcc/testsuite/g++.dg/cpp2a/concepts-pr100557.C b/gcc/testsuite/g++.dg/cpp2a/concepts-pr100557.C
new file mode 100644
index 00000000000..8dcd0eaca51
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp2a/concepts-pr100557.C
@@ -0,0 +1,21 @@ 
+// PR c++/100557
+// { dg-do compile { target c++20 } }
+
+template <typename _Tp> _Tp declval();
+
+struct print_tag_;
+
+bool tag_invoke(print_tag_, auto);
+bool tag_invoke(print_tag_, auto obj) requires requires { *obj; };
+
+template <typename CPO, typename... Args>
+auto try_tag_invoke() noexcept(tag_invoke(declval<CPO>, declval<Args>()...)) // { dg-error "no matching function for call" }
+    -> decltype(tag_invoke(CPO(), declval<Args>()...));
+
+struct print_tag_ {
+  void operator()(auto... args) noexcept(noexcept( try_tag_invoke<print_tag_, decltype(args)...>()));
+} print;
+
+void foo() {
+  print(0);
+}