[llvm-bugs] [Bug 40755] New: Compile error occurs when -stdlib=libc++ is specified
via llvm-bugs
llvm-bugs at lists.llvm.org
Mon Feb 18 01:12:19 PST 2019
https://bugs.llvm.org/show_bug.cgi?id=40755
Bug ID: 40755
Summary: Compile error occurs when -stdlib=libc++ is specified
Product: libc++
Version: unspecified
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: All Bugs
Assignee: unassignedclangbugs at nondot.org
Reporter: ueno.masakazu at jp.fujitsu.com
CC: llvm-bugs at lists.llvm.org, mclow.lists at gmail.com
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> >
>::__node_pointer, [...]>>' to 'const
__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> >
>::__node_pointer, [...]>>' to
'__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++
$
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20190218/14ffe4eb/attachment.html>
More information about the llvm-bugs
mailing list