I just make a clearer example. do {
var str = "abcdefg" var str1 = str + "hijklmn" var range = str.startIndex..<str1.endIndex range.startIndex = range.startIndex.advancedBy(10) //fatal error: cannot increment endIndex } It seams that range.startIndex internally contains a fault endIndex(str.endIndex, it should be its own endIndex, range.endIndex), which leads the issue. Zhaoxin On Wed, May 18, 2016 at 12:02 AM, Dmitri Gribenko <griboz...@gmail.com> wrote: > On Tue, May 17, 2016 at 5:46 AM, zh ao via swift-users > <swift-users@swift.org> wrote: > > It seams that I encountered bugs in function advancedBy(). > > > > do { > > var str = "abcdefg" > > var range = str.startIndex..<str.endIndex // 0..<7 > > str += "hijklmn" > > range.endIndex = str.endIndex // 0..<14 > > let index = range.startIndex.advancedBy(10) > > //fatal error: cannot increment endIndex > > } > > Hi, > > Thank you for the report. To me, this issue looks the same as > https://bugs.swift.org/browse/SR-1487. > > Dmitri > > -- > main(i,j){for(i=2;;i++){for(j=2;j<i;j++){if(!(i%j)){j=0;break;}}if > (j){printf("%d\n",i);}}} /*Dmitri Gribenko <griboz...@gmail.com>*/ >
_______________________________________________ swift-users mailing list swift-users@swift.org https://lists.swift.org/mailman/listinfo/swift-users