diff --git a/firestore/integration_test/src/integration_test.cc b/firestore/integration_test/src/integration_test.cc index b62edbe5bf..a70503cf61 100644 --- a/firestore/integration_test/src/integration_test.cc +++ b/firestore/integration_test/src/integration_test.cc @@ -651,6 +651,14 @@ TEST_F(FirebaseFirestoreBasicTest, TestQuery) { "int", firebase::firestore::FieldValue::Integer(101)))))); } +TEST_F(FirebaseFirestoreBasicTest, TestDocumentChangeNpos) { + // This test may seem pointless, but it exists to avoid the long-standing + // latent bug that `npos` was not defined on non-Android platforms and + // would therefore fail to link if used. + EXPECT_EQ(firebase::firestore::DocumentChange::npos, + static_cast(-1)); +} + TEST_F(FirebaseFirestoreBasicTest, TestInvalidatingReferencesWhenDeletingFirestore) { delete firestore_; diff --git a/firestore/integration_test_internal/src/integration_test.cc b/firestore/integration_test_internal/src/integration_test.cc index b62edbe5bf..a70503cf61 100644 --- a/firestore/integration_test_internal/src/integration_test.cc +++ b/firestore/integration_test_internal/src/integration_test.cc @@ -651,6 +651,14 @@ TEST_F(FirebaseFirestoreBasicTest, TestQuery) { "int", firebase::firestore::FieldValue::Integer(101)))))); } +TEST_F(FirebaseFirestoreBasicTest, TestDocumentChangeNpos) { + // This test may seem pointless, but it exists to avoid the long-standing + // latent bug that `npos` was not defined on non-Android platforms and + // would therefore fail to link if used. + EXPECT_EQ(firebase::firestore::DocumentChange::npos, + static_cast(-1)); +} + TEST_F(FirebaseFirestoreBasicTest, TestInvalidatingReferencesWhenDeletingFirestore) { delete firestore_; diff --git a/firestore/src/common/document_change.cc b/firestore/src/common/document_change.cc index 9908b679cb..780ae27302 100644 --- a/firestore/src/common/document_change.cc +++ b/firestore/src/common/document_change.cc @@ -23,6 +23,8 @@ using Type = DocumentChange::Type; // Older NDK (r16b) fails to define this properly. Fix this when support for // the older NDK is removed. const std::size_t DocumentChange::npos = static_cast(-1); +#else +constexpr std::size_t DocumentChange::npos; #endif // defined(ANDROID) DocumentChange::DocumentChange() {} diff --git a/release_build_files/readme.md b/release_build_files/readme.md index 04e65f843a..bc1fa8df34 100644 --- a/release_build_files/readme.md +++ b/release_build_files/readme.md @@ -567,6 +567,11 @@ code. ## Release Notes +### 8.1.0 +- Changes + - Firestore: Fixed a linker error when `DocumentChange::npos` was used. + ([#474](https://github.com/firebase/firebase-cpp-sdk/pull/474)). + ### 8.0.0 - Changes - Analytics: Removed `SetCurrentScreen()` following its removal from iOS SDK