Skip to content

Commit c768200

Browse files
Update std.cpp
1 parent c0f6224 commit c768200

1 file changed

Lines changed: 26 additions & 0 deletions

File tree

test/cfg/std.cpp

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5025,6 +5025,32 @@ void beginEnd()
50255025
std::crend(arr);
50265026
}
50275027

5028+
struct S_constParameter_std_begin { // #11617
5029+
int a[2];
5030+
};
5031+
5032+
struct T_constParameter_std_begin {
5033+
std::vector<int> v;
5034+
};
5035+
5036+
void f(S_constParameter_std_begin& s) {
5037+
std::for_each(std::begin(s.a), std::end(s.a), [](auto& i) { ++i; });
5038+
}
5039+
5040+
// cppcheck-suppress constParameterReference - FP
5041+
void f(T_constParameter_std_begin& t) {
5042+
std::for_each(std::begin(t.v), std::end(t.v), [](auto& i) { ++i; });
5043+
}
5044+
5045+
void g_constVariable_std_begin(int* p) { *p = 0; }
5046+
5047+
int f_constVariable_std_begin() {
5048+
int arr[1];
5049+
g_constVariable_std_begin(std::begin(arr));
5050+
*std::begin(arr) = 1;
5051+
return arr[0];
5052+
}
5053+
50285054
void smartPtr_get()
50295055
{
50305056
std::unique_ptr<int> p;

0 commit comments

Comments
 (0)