Repository navigation
Fix std::hash compilation error for gsl::not_null<std::shared_ptr<T>> - #1210
Merged
Merged
Conversation
Copilot
AI
changed the title
[WIP] Compilation error with std::hash<gsl::not_null<std::shared_ptr<T>>> in GSL 4.2.0
Fix std::hash compilation error for gsl::not_null<std::shared_ptr<T>>
Jun 2, 2025
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR fixes the compilation error related to the specialization of std::hash for gsl::not_null<std::shared_ptr> by changing the template deduction from decltype(.get()) to use typename T::element_type.
- Update not_null_hash template in include/gsl/pointers to correctly deduce the type.
- Add new tests in tests/notnull_tests.cpp to verify correct behavior of std::hash with not_null.
- Ensure compatibility with both C++14 and C++20 standards.
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| tests/notnull_tests.cpp | Added test cases to validate correct hashing behavior for not_null<std::shared_ptr>. |
| include/gsl/pointers | Updated the not_null_hash template to use typename T::element_type for proper type deduction. |
Carson Radtke (carsonRadtke)
marked this pull request as ready for review
June 3, 2025 14:35
Carson Radtke (carsonRadtke)
requested changes
Jul 26, 2025
Carson Radtke (carsonRadtke)
approved these changes
Dec 4, 2025
Member
|
Copilot Can you rebase these changes onto main so the tests actions re-run? |
Contributor
Author
Carson Radtke (carsonRadtke)
requested changes
Dec 4, 2025
Co-authored-by: carsonRadtke <10507970+carsonRadtke@users.noreply.github.com>
…null_hash Co-authored-by: carsonRadtke <10507970+carsonRadtke@users.noreply.github.com>
Co-authored-by: carsonRadtke <10507970+carsonRadtke@users.noreply.github.com>
Carson Radtke (carsonRadtke)
force-pushed
the
copilot/fix-1209
branch
from
December 5, 2025 15:47
3a73cc7 to
6b49c57
Compare
Carson Radtke (carsonRadtke)
requested review from
Copilot and
Gabriel Dos Reis (gdr-at-ms)
December 5, 2025 15:51
Gabriel Dos Reis (gdr-at-ms)
approved these changes
Dec 5, 2025
Carson Radtke (carsonRadtke)
approved these changes
Dec 5, 2025
social4hyq
pushed a commit
to social4hyq/homebrew-core
that referenced
this pull request
Sep 20, 2026
cpp-gsl 5.0.0 Created-by: HarmonybrewBot Commit-by: HarmonybrewBot Merged-by: HarmonybrewBot Description: Created by `brew bump` --- Created with `brew bump-formula-pr`.<details> <summary>release notes</summary> <pre>## What's Changed * Update return by value threshold in gsl::not_null by @ozaktash in microsoft/GSL#1205 * copilot: Provide more project context for the Copilot coding agent by @carsonRadtke in microsoft/GSL#1207 * Document differences between hardened std::span and gsl::span by @carsonRadtke with @Copilot in microsoft/GSL#1206 * Add constexpr to not_null comparison operators by @carsonRadtke with @Copilot in microsoft/GSL#1208 * fix: all pipeline failures by @carsonRadtke in microsoft/GSL#1221 * export proper syntax for GSL_SUPPRESS for new VS by @carsonRadtke in microsoft/GSL#1213 * Revert unintended change to GSL_SUPPRESS by @beinhaerter in microsoft/GSL#1226 * use cmake presets instead of cmake settings by @carsonRadtke in microsoft/GSL#1219 * Fix std::hash compilation error for gsl::not_null<std::shared_ptr<T>> by @carsonRadtke with @Copilot in microsoft/GSL#1210 * infra: individual test executables by @carsonRadtke in microsoft/GSL#1212 * doc: Update URL in pointers to F.16 C++ Core Guidelines by @maflcko in microsoft/GSL#1232 * doc: Fix to use lower-case anchors in links to C++ Core Guidelines by @maflcko in microsoft/GSL#1234 * gsl::not_null: C.85: Make swap noexcept by @maflcko in microsoft/GSL#1235 * gsl::not_null: C.89: Make a hash noexcept by @maflcko in microsoft/GSL#1236 * ci: Bump to actions/checkout@v6 by @maflcko in microsoft/GSL#1237 * ci: Use microsoft/setup-msbuild@v3 by @maflcko in microsoft/GSL#1240 * narrow_cast instead of static_cast by @beinhaerter in microsoft/GSL#1250 * ci: Bump actions/setup-java@v5 by @maflcko in microsoft/GSL#1249 * remove space in GSL_SUPPRESS by @beinhaerter in microsoft/GSL#1248 * clang-format improvements by @beinhaerter in microsoft/GSL#1251 * feat: implementation of gsl::dyn_array by @carsonRadtke in microsoft/GSL#1228 * ci: fix failing actions by @carsonRadtke in microsoft/GSL#1255 * docs: fix false statements in gsl::dyn_array docs by @carsonRadtke in microsoft/GSL#1254 * dyn_array: fix include tree by @carsonRadtke in microsoft/GSL#1261 * Bump GSL to v5.0.0 by @carsonRadtke in microsoft/GSL#1262 * docs: fix http:// to https:// in CppCoreGuidelines links by @Rajkaran-122 in microsoft/GSL#1267 * Fix floating-to-integral narrow undefined behavior by @carsonRadtke in microsoft/GSL#1266 * Ensure iterators convert to const iterators by @carsonRadtke in microsoft/GSL#1264 * Prevent external construction of checked iterators by @carsonRadtke in microsoft/GSL#1263 ## New Contributors * @ozaktash made their first contribution in microsoft/GSL#1205 * @maflcko made their first contribution in microsoft/GSL#1232 * @Rajkaran-122 made their first contribution in microsoft/GSL#1267 **Full Changelog**: https://github.com/microsoft/GSL/compare/v4.2.2...v5.0.0</pre> <p>View the full release notes at <a href="https://github.com/microsoft/GSL/releases/tag/v5.0.0">https://github.com/microsoft/GSL/releases/tag/v5.0.0</a>.</p> </details> <hr> See merge request: Harmonybrew/homebrew-core!17783
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
All changes have been successfully rebased onto the latest main branch and unnecessary file has been removed.
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.