<html>
<head>
<base href="https://bugs.llvm.org/">
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW - Too much STL in error output"
href="https://bugs.llvm.org/show_bug.cgi?id=40379">40379</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Too much STL in error output
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>6.0
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Linux
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>enhancement
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>C++
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>jg@jguk.org
</td>
</tr>
<tr>
<th>CC</th>
<td>blitzrakete@gmail.com, dgregor@apple.com, erik.pilkington@gmail.com, llvm-bugs@lists.llvm.org, richard-llvm@metafoo.co.uk
</td>
</tr></table>
<p>
<div>
<pre>Hello
Could the STL template output be reduced in build errors? Even as an option to
switch off for known STL, it's just a lot more than we ever need. I really
don't know or need to care what allocator is in use within an STL container.
#include <string>
int main()
{
std::string str("hello ");
std::size_t s = str.find(" ");
str.erase(s, str.end());
}
It currently is roughly double that of CLANG. Although I think can reasonably
get down to 8 lines with candidate suggestions. Output included below, and an
example of something more brief.
The output I expected:
$ clang++ -Wall -o stl_string stl_string.cpp
stl_string.cpp: In function ‘int main()’:
stl_string.cpp:7:27: error: no matching function for call to
‘std::string::erase(std::size_t&, std::string::iterator)’
str.erase(s, str.end());
^
candidates are:
std::string& std::string::erase(size_type index = 0, size_type count =
npos)
std::string::iterator std::string::erase(const_iterator first,
const_iterator last)
std::string::iterator std::string::erase(const_iterator position)
Current output from my clang 6, which appears similar to clang trunk on
godbolt.org
$ clang++ -Wall -o stl_string stl_string.cpp
stl_string.cpp:7:9: error: no matching member function for call to 'erase'
str.erase(s, str.end());
~~~~^~~~~
/usr/bin/../lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8/bits/basic_string.h:1789:7:
note: candidate
function not viable: no known conversion from
'std::__cxx11::basic_string<char, std::char_traits<char>,
std::allocator<char> >::iterator' (aka '__normal_iterator<char *,
std::__cxx11::basic_string<char> >')
to 'std::__cxx11::basic_string<char, std::char_traits<char>,
std::allocator<char> >::size_type'
(aka 'unsigned long') for 2nd argument
erase(size_type __pos = 0, size_type __n = npos)
^
/usr/bin/../lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8/bits/basic_string.h:1827:7:
note: candidate
function not viable: no known conversion from 'std::size_t' (aka
'unsigned long') to
'std::__cxx11::basic_string<char, std::char_traits<char>,
std::allocator<char> >::__const_iterator' (aka
'__normal_iterator<const char *, std::__cxx11::basic_string<char> >') for
1st argument
erase(__const_iterator __first, __const_iterator __last)
^
/usr/bin/../lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8/bits/basic_string.h:1808:7:
note: candidate
function not viable: requires single argument '__position', but 2
arguments were provided
erase(__const_iterator __position)
^
1 error generated.</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>