Skip to content

Commit 7ecd4c4

Browse files
Update teststl.cpp
1 parent c9c660e commit 7ecd4c4

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

test/teststl.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4568,6 +4568,14 @@ class TestStl : public TestFixture {
45684568
"[test.cpp:14:10]: (performance) Passing the result of c_str() to a stream is slow and redundant. [stlcstrStream]\n",
45694569
errout_str());
45704570

4571+
check("void f(const std::string& s) {\n"
4572+
" std::cout << s.c_str();\n"
4573+
" std::cerr << s.c_str();\n"
4574+
"}\n");
4575+
ASSERT_EQUALS("[test.cpp:2:15]: (performance) Passing the result of c_str() to a stream is slow and redundant. [stlcstrStream]\n"
4576+
"[test.cpp:3:15]: (performance) Passing the result of c_str() to a stream is slow and redundant. [stlcstrStream]\n",
4577+
errout_str());
4578+
45714579
check("struct S { std::string str; };\n"
45724580
"struct T { S s; };\n"
45734581
"struct U { T t[1]; };\n"

0 commit comments

Comments
 (0)