<html>
<head>
<base href="https://llvm.org/bugs/" />
</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 --- - In std=g++11, conversion using P::operator const std::string fails"
href="https://llvm.org/bugs/show_bug.cgi?id=26457">26457</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>In std=g++11, conversion using P::operator const std::string fails
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>3.7
</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>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>C++11
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>quicklydeliverit@sogetthis.com
</td>
</tr>
<tr>
<th>CC</th>
<td>dgregor@apple.com, llvm-bugs@lists.llvm.org
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>Created <span class=""><a href="attachment.cgi?id=15816" name="attach_15816" title="testcase">attachment 15816</a> <a href="attachment.cgi?id=15816&action=edit" title="testcase">[details]</a></span>
testcase
Appended testcase fails to compile on clang 3.7 in C++11. G++ fails not, which
does not have to mean anything. Who's right and who's wrong?
$ clang -v
clang version 3.7.0 (tags/RELEASE_370/final 246586)
Target: x86_64-suse-linux
Thread model: posix
Found candidate GCC installation: /usr/bin/../lib64/gcc/x86_64-suse-linux/4.8
Found candidate GCC installation: /usr/bin/../lib64/gcc/x86_64-suse-linux/5
Found candidate GCC installation: /usr/lib64/gcc/x86_64-suse-linux/4.8
Found candidate GCC installation: /usr/lib64/gcc/x86_64-suse-linux/5
Selected GCC installation: /usr/bin/../lib64/gcc/x86_64-suse-linux/5
Candidate multilib: .;@m64
Selected multilib: .;@m64
$ g++ -c zcu.cpp -Wall
$ g++ -c zcu.cpp -Wall -std=gnu++11
$ clang++ -c zcu.cpp -Wall
$ clang++ -c zcu.cpp -Wall -std=gnu++11
In file included from zcu.cpp:1:
In file included from
/usr/bin/../lib64/gcc/x86_64-suse-linux/5/../../../../include/c++/5/set:60:
In file included from
/usr/bin/../lib64/gcc/x86_64-suse-linux/5/../../../../include/c++/5/bits/stl_tree.h:63:
/usr/bin/../lib64/gcc/x86_64-suse-linux/5/../../../../include/c++/5/bits/stl_algobase.h:310:18:
error: no viable
conversion from 'const SOURCEKEY' to 'typename set<basic_string<char>,
less<basic_string<char> >,
allocator<basic_string<char> > >::value_type' (aka
'std::__cxx11::basic_string<char>')
*__result = *__first;
^~~~~~~~
/usr/bin/../lib64/gcc/x86_64-suse-linux/5/../../../../include/c++/5/bits/stl_algobase.h:400:36:
note: in instantiation
of function template specialization 'std::__copy_move<false, false,
std::bidirectional_iterator_tag>::__copy_m<std::_Rb_tree_const_iterator<SOURCEKEY>,
std::insert_iterator<std::set<std::__cxx11::basic_string<char>,
std::less<std::__cxx11::basic_string<char> >,
std::allocator<std::__cxx11::basic_string<char> > > > >' requested here
_Category>::__copy_m(__first, __last, __result);
^
/usr/bin/../lib64/gcc/x86_64-suse-linux/5/../../../../include/c++/5/bits/stl_algobase.h:436:23:
note: in instantiation
of function template specialization 'std::__copy_move_a<false,
std::_Rb_tree_const_iterator<SOURCEKEY>,
std::insert_iterator<std::set<std::__cxx11::basic_string<char>,
std::less<std::__cxx11::basic_string<char> >,
std::allocator<std::__cxx11::basic_string<char> > > > >' requested here
return _OI(std::__copy_move_a<_IsMove>(std::__niter_base(__first),
^
/usr/bin/../lib64/gcc/x86_64-suse-linux/5/../../../../include/c++/5/bits/stl_algobase.h:468:20:
note: in instantiation
of function template specialization 'std::__copy_move_a2<false,
std::_Rb_tree_const_iterator<SOURCEKEY>,
std::insert_iterator<std::set<std::__cxx11::basic_string<char>,
std::less<std::__cxx11::basic_string<char> >,
std::allocator<std::__cxx11::basic_string<char> > > > >' requested here
return (std::__copy_move_a2<__is_move_iterator<_II>::__value>
^
zcu.cpp:20:7: note: in instantiation of function template specialization
'std::copy<std::_Rb_tree_const_iterator<SOURCEKEY>,
std::insert_iterator<std::set<std::__cxx11::basic_string<char>,
std::less<std::__cxx11::basic_string<char> >,
std::allocator<std::__cxx11::basic_string<char> > > > >' requested here
std::copy(setFolders.begin(), setFolders.end(), std::inserter(setIds,
setIds.begin()));
^
/usr/bin/../lib64/gcc/x86_64-suse-linux/5/../../../../include/c++/5/bits/basic_string.h:399:7:
note: candidate
constructor not viable: no known conversion from 'const SOURCEKEY' to
'const std::__cxx11::basic_string<char> &'
for 1st argument
basic_string(const basic_string& __str)
^
/usr/bin/../lib64/gcc/x86_64-suse-linux/5/../../../../include/c++/5/bits/basic_string.h:455:7:
note: candidate
constructor not viable: no known conversion from 'const SOURCEKEY' to
'const char *' for 1st argument
basic_string(const _CharT* __s, const _Alloc& __a = _Alloc())
^
/usr/bin/../lib64/gcc/x86_64-suse-linux/5/../../../../include/c++/5/bits/basic_string.h:477:7:
note: candidate
constructor not viable: no known conversion from 'const SOURCEKEY' to
'std::__cxx11::basic_string<char> &&' for
1st argument
basic_string(basic_string&& __str) noexcept
^
/usr/bin/../lib64/gcc/x86_64-suse-linux/5/../../../../include/c++/5/bits/basic_string.h:504:7:
note: candidate
constructor not viable: no known conversion from 'const SOURCEKEY' to
'initializer_list<char>' for 1st argument
basic_string(initializer_list<_CharT> __l, const _Alloc& __a = _Alloc())
^
zcu.cpp:11:2: note: candidate function
operator unsigned char *() const;
^
zcu.cpp:12:2: note: candidate function
operator const std::string () const;
^
/usr/bin/../lib64/gcc/x86_64-suse-linux/5/../../../../include/c++/5/bits/stl_iterator.h:659:51:
note: passing argument
to parameter '__value' here
operator=(typename _Container::value_type&& __value)
^
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>