<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 - Compile error occurs when -stdlib=libc++ is specified"
href="https://bugs.llvm.org/show_bug.cgi?id=40755">40755</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Compile error occurs when -stdlib=libc++ is specified
</td>
</tr>
<tr>
<th>Product</th>
<td>libc++
</td>
</tr>
<tr>
<th>Version</th>
<td>unspecified
</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>All Bugs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>ueno.masakazu@jp.fujitsu.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org, mclow.lists@gmail.com
</td>
</tr></table>
<p>
<div>
<pre>If -stdlib=libc++ is specified, a compiler error occurs because there is a
const qualification bug.
* source code
#include <string.h>
#include <stdio.h>
#include <map>
using namespace std;
class test_class {
public:
int i;
map<string, int> map_a;
public:
bool is_bbb(int t) {
static map<const string, int>::iterator it;
if (t == 0) {
it = map_a.begin();
return true;
}
return false;
}
};
* error message
$ clang++ -O3 args_parser.cpp -c -stdlib=libc++
args_parser.cpp:16:10: error: no viable overloaded '='
it = map_a.begin();
~~ ^ ~~~~~~~~~~~~~
/opt/llvm/svn-trunk/install/bin/../include/c++/v1/map:776:28: note: candidate
function (the implicit copy assignment operator) not viable: no known
conversion from '__map_iterator<__tree_iterator<__value_type<basic_string<...>,
[...]>, std::__1::__tree<std::__1::__value_type<std::__1::basic_string<char,
std::__1::char_traits<char>, std::__1::allocator<char> >, int>,
std::__1::__map_value_compare<std::__1::basic_string<char,
std::__1::char_traits<char>, std::__1::allocator<char> >,
std::__1::__value_type<std::__1::basic_string<char,
std::__1::char_traits<char>, std::__1::allocator<char> >, int>,
std::__1::less<std::__1::basic_string<char, std::__1::char_traits<char>,
std::__1::allocator<char> > >, true>,
std::__1::allocator<std::__1::__value_type<std::__1::basic_string<char,
std::__1::char_traits<char>, std::__1::allocator<char> >, int> >
<span class="quote">>::__node_pointer, [...]>>' to 'const</span >
__map_iterator<__tree_iterator<__value_type<const basic_string<...>,
[...]>, std::__1::__tree_node<std::__1::__value_type<const
std::__1::basic_string<char, std::__1::char_traits<char>,
std::__1::allocator<char> >, int>, void *> *, [...]>>' for 1st argument
class _LIBCPP_TEMPLATE_VIS __map_iterator
^
/opt/llvm/svn-trunk/install/bin/../include/c++/v1/map:776:28: note: candidate
function (the implicit move assignment operator) not viable: no known
conversion from '__map_iterator<__tree_iterator<__value_type<basic_string<...>,
[...]>, std::__1::__tree<std::__1::__value_type<std::__1::basic_string<char,
std::__1::char_traits<char>, std::__1::allocator<char> >, int>,
std::__1::__map_value_compare<std::__1::basic_string<char,
std::__1::char_traits<char>, std::__1::allocator<char> >,
std::__1::__value_type<std::__1::basic_string<char,
std::__1::char_traits<char>, std::__1::allocator<char> >, int>,
std::__1::less<std::__1::basic_string<char, std::__1::char_traits<char>,
std::__1::allocator<char> > >, true>,
std::__1::allocator<std::__1::__value_type<std::__1::basic_string<char,
std::__1::char_traits<char>, std::__1::allocator<char> >, int> >
<span class="quote">>::__node_pointer, [...]>>' to</span >
'__map_iterator<__tree_iterator<__value_type<const basic_string<...>,
[...]>, std::__1::__tree_node<std::__1::__value_type<const
std::__1::basic_string<char, std::__1::char_traits<char>,
std::__1::allocator<char> >, int>, void *> *, [...]>>' for 1st argument
1 error generated.
$
* Note
There is no problem if -stdlib=libstdc++ option is valid.
$ clang++ -O3 aaa.cpp -c -stdlib=libstdc++
$</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>