Skip to content

Instantly share code, notes, and snippets.

@markpapadakis
Created October 7, 2015 07:41
Show Gist options
  • Save markpapadakis/5eb016935423fddaf03e to your computer and use it in GitHub Desktop.
Save markpapadakis/5eb016935423fddaf03e to your computer and use it in GitHub Desktop.
// This will crash clang++-3.7
std::sort(list->begin(), list->end(), [](const fixup_candidate &c1, const fixup_candidate &c2)
{
if (c2.rangeSpan < c1.rangeSpan)
return true;
else if (c2.rangeSpan == c1.rangeSpan)
return c2.candiate.len < c1.candidate.len;
else
return false;
});
// This works fine
std::sort(list->begin(), list->end(), [](const fixup_candidate &c1, const fixup_candidate &c2)
{
return c2.rangeSpan < c1.rangeSpan || (c2.rangeSpan == c1.rangeSpan && c2.candidate.len < c1.candidate.len);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment