diff mbox series

[pushed:,r15-4983] testsuite: add infinite recursion test case [PR63388]

Message ID 20241106135009.3073344-1-dmalcolm@redhat.com
State New
Headers show
Series [pushed:,r15-4983] testsuite: add infinite recursion test case [PR63388] | expand

Commit Message

David Malcolm Nov. 6, 2024, 1:50 p.m. UTC
Successfully bootstrapped & regrtested on x86_64-pc-linux-gnu.
Pushed to trunk as r15-4983-g85736ba8e1fc4a.

gcc/testsuite/ChangeLog:
	PR c++/63388
	* g++.dg/analyzer/infinite-recursion-pr63388.C: New test.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
---
 .../analyzer/infinite-recursion-pr63388.C     | 21 +++++++++++++++++++
 1 file changed, 21 insertions(+)
 create mode 100644 gcc/testsuite/g++.dg/analyzer/infinite-recursion-pr63388.C
diff mbox series

Patch

diff --git a/gcc/testsuite/g++.dg/analyzer/infinite-recursion-pr63388.C b/gcc/testsuite/g++.dg/analyzer/infinite-recursion-pr63388.C
new file mode 100644
index 000000000000..74af8cad3fff
--- /dev/null
+++ b/gcc/testsuite/g++.dg/analyzer/infinite-recursion-pr63388.C
@@ -0,0 +1,21 @@ 
+// { dg-do compile { target c++11 } }
+
+namespace std
+{
+  class ostream;
+  extern ostream cout;
+}
+
+enum class Month {jan=1, feb, mar, apr, may, jun, jul, aug, sep, oct, nov, dec};
+
+std::ostream& operator<<(std::ostream& os, Month m)
+{
+  return os << m; // { dg-warning "infinite recursion" }
+}
+
+int main()
+{
+  Month m = Month::may;
+  std::cout << m;
+  return 0;
+}