Implement LWG-4293: span::subspan/first/last chooses wrong constructor when T is const-qualified bool by tycket033-tech · Pull Request #6437 · microsoft/STL · GitHub
Skip to content

Implement LWG-4293: span::subspan/first/last chooses wrong constructor when T is const-qualified bool - #6437

Open
zika (tycket033-tech) wants to merge 2 commits into
microsoft:mainfrom
tycket033-tech:issue-6239-lwg-4293-span-subspan
Open

Implement LWG-4293: span::subspan/first/last chooses wrong constructor when T is const-qualified bool#6437
zika (tycket033-tech) wants to merge 2 commits into
microsoft:mainfrom
tycket033-tech:issue-6239-lwg-4293-span-subspan

Conversation

@tycket033-tech

Copy link
Copy Markdown
Contributor

Fixes #6239

LWG-4293 changes the Effects of span::first/last/subspan to
direct-initialize the returned span ((ptr, count)) instead of brace-initializing,
so an initializer_list constructor can never hijack these calls.

Since P2447R6 was reverted and MSVC STL never implemented it anyway, this has
zero functional impact — just a wording-sync per "Do What The Standard Says".

Copilot AI balanced review requested due to automatic review settings September 4, 2026 18:34
@tycket033-tech
zika (tycket033-tech) requested a review from a team as a code owner September 4, 2026 18:34
@github-project-automation github-project-automation Bot moved this to Initial Review in STL Code Reviews Sep 4, 2026
@azure-pipelines

Copy link
Copy Markdown

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The implementation consistently applies LWG-4293 across every affected overload with matching test coverage.

Pull request overview

Aligns std::span subview construction with LWG-4293.

Changes:

  • Direct-initializes spans returned by first, last, and subspan.
  • Adds constexpr/runtime coverage for span<const bool> subviews.
File summaries
File Description
stl/inc/span Updates all subview return constructions.
tests/std/tests/P0122R7_span/test.cpp Tests const-qualified Boolean subviews.
Review details
  • Files reviewed: 2/2 changed files
  • Comments generated: 0
  • Review effort level: Balanced

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread stl/inc/span Outdated
Comment thread tests/std/tests/P0122R7_span/test.cpp Outdated
Copilot AI review requested due to automatic review settings September 5, 2026 08:07

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The implementation consistently applies the wording change and includes appropriate compile-time and runtime coverage.

Review details
  • Files reviewed: 2/2 changed files
  • Comments generated: 0 new
  • Review effort level: Balanced

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Initial Review

Development

Successfully merging this pull request may close these issues.

LWG-4293 span::subspan/first/last chooses wrong constructor when T is const-qualified bool

3 participants