[libcxx-commits] [libcxx] [libcxx] [test] Fix the gets-removed.verify.cpp test with Clang 21 (PR #169235)
via libcxx-commits
libcxx-commits at lists.llvm.org
Sun Nov 23 12:33:33 PST 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-libcxx
Author: Martin Storsjö (mstorsjo)
<details>
<summary>Changes</summary>
This fixes test errors like this, at least for a mingw target, if building with Clang 21 instead of Clang 20, as in the CI environment:
# .---command stderr------------
# | error: 'expected-error' diagnostics seen but not expected:
# | File C:\a\llvm-mingw\llvm-mingw\llvm-project\libcxx\test\std\input.output\file.streams\c.files\gets-removed.verify.cpp Line 16: cannot initialize a parameter of type 'char *' with an lvalue of type 'const char *'
# | 1 error generated.
# `-----------------------------
# error: command failed with exit status: 1
This extra, unexpected diagnostic appears in Clang 21, since commit 9eef4d1c5fa6b1bcbbe675c14ca8301d5d346f7b ("Remove delayed typo expressions"). Before this, we got the expected diagnostic `error: no member named 'gets' in namespace 'std'`, with the typo correction hint `did you mean 'puts'?`. After this change, we get the typo correction hint `did you mean simply 'gets'?` instead. And with the typo correction finding `::gets`, it goes on to produce a second diagnostic about mismatched parameter for that function.
Avoid these unexpected diagnostics by passing the right type of parameter to the gets function.
---
Full diff: https://github.com/llvm/llvm-project/pull/169235.diff
1 Files Affected:
- (modified) libcxx/test/std/input.output/file.streams/c.files/gets-removed.verify.cpp (+1-1)
``````````diff
diff --git a/libcxx/test/std/input.output/file.streams/c.files/gets-removed.verify.cpp b/libcxx/test/std/input.output/file.streams/c.files/gets-removed.verify.cpp
index 281ef37e92d27..fb49375a21baa 100644
--- a/libcxx/test/std/input.output/file.streams/c.files/gets-removed.verify.cpp
+++ b/libcxx/test/std/input.output/file.streams/c.files/gets-removed.verify.cpp
@@ -12,6 +12,6 @@
#include <cstdio>
-void f(char const* str) {
+void f(char* str) {
(void)std::gets(str); // expected-error {{no member named 'gets' in namespace 'std'}}
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/169235
More information about the libcxx-commits
mailing list