[pushed] c++: add fixed test [PR127551]
Commit Message
Tested x86_64-pc-linux-gnu, applying to trunk.
-- >8 --
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.
---
gcc/testsuite/g++.dg/torture/pr127551.C | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
create mode 100644 gcc/testsuite/g++.dg/torture/pr127551.C
base-commit: f31d4844cf3c35566ba7e06a2097dc51ea55369d
new file mode 100644
@@ -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 ();
+}