[llvm-bugs] [Bug 26457] New: In std=g++11, conversion using P::operator const std::string fails
via llvm-bugs
llvm-bugs at lists.llvm.org
Wed Feb 3 08:51:30 PST 2016
https://llvm.org/bugs/show_bug.cgi?id=26457
Bug ID: 26457
Summary: In std=g++11, conversion using P::operator const
std::string fails
Product: clang
Version: 3.7
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: C++11
Assignee: unassignedclangbugs at nondot.org
Reporter: quicklydeliverit at sogetthis.com
CC: dgregor at apple.com, llvm-bugs at lists.llvm.org
Classification: Unclassified
Created attachment 15816
--> https://llvm.org/bugs/attachment.cgi?id=15816&action=edit
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.
--
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/20160203/bf952fd2/attachment-0001.html>
More information about the llvm-bugs
mailing list