https://gcc.gnu.org/g:ac857f25eb8d23a31f1be84cd40b67f129e204ba

commit r17-4845-gac857f25eb8d23a31f1be84cd40b67f129e204ba
Author: Marek Polacek <[email protected]>
Date:   Fri Oct 2 14:44:02 2026 -0400

    c++: add fixed test [PR127551]
    
    A wrong-code bug fixed by r17-4696.  Seems pretty important to
    test that it keeps working.
    
            PR c++/127551
    
    gcc/testsuite/ChangeLog:
    
            * g++.dg/torture/pr127551.C: New test.

Diff:
---
 gcc/testsuite/g++.dg/torture/pr127551.C | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/gcc/testsuite/g++.dg/torture/pr127551.C 
b/gcc/testsuite/g++.dg/torture/pr127551.C
new file mode 100644
index 000000000000..2594f614f2fb
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr127551.C
@@ -0,0 +1,18 @@
+// PR c++/127551
+// { dg-do run { target c++17 } }
+
+#include <string_view>
+
+int
+main ()
+{
+  constexpr std::string_view test = "hello";
+  auto pos = test.find_first_of('l', 2);
+  if (pos != 2)
+    __builtin_abort ();
+
+  std::string_view test2 = "hello";
+  auto pos2 = test2.find_first_of('l', 2);
+  if (pos2 != 2)
+    __builtin_abort ();
+}

Reply via email to