Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions cfg/std.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -7130,13 +7130,30 @@ The obsolete function 'gets' is called. With 'gets' you'll get a buffer overrun
<returnValue type="const char *"/>
<noreturn>false</noreturn>
</function>
<!-- const wchar_t* c_str() const; // until C++11 -->
<!-- const wchar_t* c_str() const noexcept; // since C++11 -->
<!-- const wchar_t* data() const; // until C++11 -->
<!-- const wchar_t* data() const noexcept; // since C++11 -->
<function name="std::wstring::c_str,std::wstring::data">
<use-retval/>
<const/>
<returnValue type="const wchar_t *"/>
<noreturn>false</noreturn>
</function>
<!-- char& front(); -->
<!-- const char& front() const; -->
<function name="std::string::front">
<use-retval/>
<returnValue type="char &amp;"/>
<noreturn>false</noreturn>
</function>
<!-- wchar_t& front(); -->
<!-- const wchar_t& front() const; -->
<function name="std::wstring::front">
<use-retval/>
<returnValue type="wchar_t &amp;"/>
<noreturn>false</noreturn>
</function>
<!-- size_t find (const string& str, size_t pos = 0) const; -->
<!-- size_t find (const char* s, size_t pos, size_t n) const; -->
<!-- size_t find (char c, size_t pos = 0) const;-->
Expand Down
16 changes: 15 additions & 1 deletion test/cfg/std.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5166,6 +5166,20 @@ void constVariablePointer_push_back(std::vector<T*>& d, const std::vector<T*>& s
}
}

struct S_constVariablePointer_wstring { // #14575
std::wstring m;
const std::wstring& get() const { return m; }
};

S_constVariablePointer_wstring* g_constVariablePointer_wstring();

void h_constVariablePointer_wstring(const wchar_t*);

void f_constVariablePointer_wstring() {
S_constVariablePointer_wstring* s = g_constVariablePointer_wstring(); // cppcheck-suppress constVariablePointer
h_constVariablePointer_wstring(s->get().c_str());
}

std::streampos constParameterPointer_istream_tellg(std::istream* p) { // #13801
return p->tellg();
}
Expand Down Expand Up @@ -5318,4 +5332,4 @@ int containerOutOfBounds_std_initializer_list() { // #14340
// cppcheck-suppress derefInvalidIterator
int i = *x.end();
return i + containerOutOfBounds_std_initializer_list_access(x);
}
}
Loading