Unable to compile Scintilla 4.4.3 with Xcode 12.0 beta (12A8158a):
In file included from /Users/cqn/Desktop/scintilla/src/ViewStyle.cxx:13:
In file included from /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/string_view:175:
In file included from /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/__string:57:
In file included from /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/algorithm:643:
/Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/memory:1720:13: error: static_assert failed due to requirement '__is_cpp17_move_insertable<std::__1::allocator<Scintilla::Style>, false>::value' "The specified type does not meet the requirements of Cpp17MoveInsertable"
static_assert(__is_cpp17_move_insertable<allocator_type>::value,
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /Users/cqn/Desktop/scintilla/src/ViewStyle.cxx:14:
/Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/vector:952:21: note: in instantiation of function template specialization 'std::__1::allocator_traits<std::__1::allocator<Scintilla::Style> >::__construct_backward_with_exception_guarantees<Scintilla::Style *>' requested here
__alloc_traits::__construct_backward_with_exception_guarantees(
^
/Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/vector:1094:9: note: in instantiation of member function 'std::__1::vector<Scintilla::Style, std::__1::allocator<Scintilla::Style> >::__swap_out_circular_buffer' requested here
__swap_out_circular_buffer(__v);
^
/Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/vector:2022:15: note: in instantiation of member function 'std::__1::vector<Scintilla::Style, std::__1::allocator<Scintilla::Style> >::__append' requested here
this->__append(__sz - __cs);
^
/Users/cqn/Desktop/scintilla/src/ViewStyle.cxx:576:9: note: in instantiation of member function 'std::__1::vector<Scintilla::Style, std::__1::allocator<Scintilla::Style> >::resize' requested here
styles.resize(sizeNew);
Style doesn't support moves as its memory management is a little strange so both move construction and move assignment are
= delete. Style contains a FontAlias (non-owning copy of a FontID) and a non-owningconst char *fontName. FontAlias has neither move and no copy assignment, just a copy constructor. There may be 120 styles which only use 1 to 5 fonts and not creating a new system font object for each style has been a worthwhile resource saving.For 5.0, I plan to change Style::font from FontAlias to a reference-counted std::shared_ptr which will have simpler, safer, and more standard semantics. The fontName field could also be made shared_ptr although its more like string interning.
Its likely OK to define some more of the FontAlias special methods as
= defaultas deleting them is done to ensure there are no changes in user code that do anything unexpected. If that doesn't get it working then try switching some special methods in Style to= default.I will try. I know very little C++ but I'll have a colleague help me.
Its unfortunate that the diagnostic isn't saying which particular element of __is_cpp17_move_insertable is missing.
You could try the attached patch which is unlikely to be optimal.
I had to make one correction to the patch where there was a
noexceptthat should've been anoexcept = default.I got an error after the addition of
other.ClearFont()toFontAlias::FontAlias(const FontAlias &other):And lastly I forgot to give you this error earlier:
I was able to muddle my way through enough to successfully build and run by commenting out the code that resulted in errors. I just wanted to confirm I could get the rest of my app to build/run.
otherisFontAlias &&otherso no const to complain about. The purpose of the argument in a move constructor is to grab its contents then empty it afterwards. The emptying can't be done if it is const.The diagnostics aren't necessarily bugs in the Scintilla code - there were similar problems with the standard library that came with a release of GCC that were fixed by a GCC update.
PositionCacheEntry is more dangerous as it has an owning pointer to
positions. However, since this is the standard librarystd::unique_ptrit should move correctly if the move operations on PositionCacheEntry are= default.Here is a version of the patch with a move assignment on FontAlias which may make it easier for the compiler to default the move assignment on Style.
That took care of errors and warnings with FontAlias and Style.
Last edit: Chinh Nguyen 2020-06-25
I think Xcode is wrong here. From the C++17 standard:
So T(&&) is required but there is no requirement for an assignment operator.
Committed fix with [2af468].
Related
Commit: [2af468]