<string_view> for libc++
G M
gmisocpp at gmail.com
Mon Jan 6 14:01:50 PST 2014
Hi Marshall
Some early feed back for your patch:
1. string_view implements it's own __min function, but this is
unfortunately a macro in mingw's stdlib.h
and therefore compilation yields these type of error's with clang++ and g++
using mingw:
----
/libcxx/include\string_view:181:18: error: expected ')'
constexpr _T __min ( const _T& __t1, const _T& __t2 )
^
c:\mingw\bin\..\lib\clang\3.5\../../../x86_64-w64-mingw32/include\stdlib.h:113:26:
note: expanded from macro '__min'
#define __min(a,b) (((a) < (b)) ? (a) : (b))
----
Changing __min to ___min which allowed it to compile for me.
^
2. With the above change in place, I find I c++1y is required. Makes sense,
but using string_view without a c++1y compiler might be a worthwhile
consideration if it's easy.
/libcxx/include\string_view:241:13: warning: use of this statement in a
constexpr function is a C++1y extension
[-Wc++1y-extensions]
if (__pos >= size ())
^
/libcxx/include\string_view:292:23: warning: variable declaration in a
constexpr function is a C++1y extension
[-Wc++1y-extensions]
size_type rlen_ = ____min ( __n, size() - __pos );
^
/libcxx/include\string_view:290:13: warning: use of this statement in a
constexpr function is a C++1y extension
[-Wc++1y-extensions]
if (__pos > size())
3. g++ reports this:
--
In file included from sv.cpp:1:0:
/libcxx/include/string_view:199:53: error: declaration of 'typedef
std::experimental::__library_fundamentals::basic_strin
_view<_CharT, _Traits>::const_reverse_iterator
std::experimental::__library_fundamentals::basic_string_view<_CharT, _Trai
s>::reverse_iterator' [-fpermissive]
typedef const_reverse_iterator reverse_iterator;
^
In file included from /libcxx/include/memory:600:0,
from /libcxx/include/algorithm:627,
from /libcxx/include/string:439,
from /libcxx/include/string_view:173,
from sv.cpp:1:
/libcxx/include/iterator:529:29: error: changes meaning of
'reverse_iterator' from 'class std::__1::reverse_iterator<cons
_CharT*>' [-fpermissive]
class _LIBCPP_TYPE_VIS_ONLY reverse_iterator
--
I commented out line 199 and it compiled. i.e.:
//typedef const_reverse_iterator reverse_iterator;
That's it for now.
I couldn't reply directly to your original post on this subject because I
couldn't find your post in my inbox, only on the archives list. I don't
know how to get around that problem when it happens.
Hope this helps.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140107/af6f7027/attachment.html>
More information about the cfe-commits
mailing list