google / libaddressinput

Google’s postal address library, powering Android and Chromium
Apache License 2.0
576 stars 104 forks source link

Fix build with Windows/libc++ #172

Closed tanderson-google closed 5 years ago

tanderson-google commented 5 years ago

This change fixes the below build error when using libc++ on Windows.

src/cpp/src/util/size.h(45,12):  error: no member named 'size' in namespace 'std'
using std::size;

This is a followup to [1] which fixed the build in some cases, but not all. As that CL points out:

We cannot solely rely on the value of _MSC_VER when determining
whether the standard library provides a definition of std::size;
we also need to make sure that the standard library is not libc++.

This is true, but the old logic would assume that the standard library would provide std::size when __cpp_lib_nonmember_container_access >= 201411. The new logic requires !defined(_LIBCPP_STD_VER) for that check too.

[1] https://github.com/googlei18n/libaddressinput/commit/d955c63ec7048d59dffd20af25eeec23da878d27

tanderson-google commented 5 years ago

Full open source update: https://github.com/googlei18n/libaddressinput/pull/174

tanderson-google commented 5 years ago

Reopening

rsolomakhin commented 5 years ago

Would you prefer to merge this patch?

rsolomakhin commented 5 years ago

Going to merge this after travis-ci completes.