{{ message }}
<regex>: Tolerate iterators with explicit default ctors#6146
Merged
StephanTLavavej merged 1 commit intoMar 10, 2026
Merged
Conversation
Member
Author
davidmrdavid
approved these changes
Mar 9, 2026
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.

Fixes internal VSO-2800682.
#6092 followed by #6127 implemented a small buffer optimization storing (potentially user-defined) iterators in an aggregate
_Rx_capture_range_t<_BidIt>, then constructing that aggregate with_Ty{}:STL/stl/inc/regex
Lines 1842 to 1846 in 8f6bbd3
STL/stl/inc/regex
Line 1748 in 8f6bbd3
This is sensitive to
explicitdefault ctors, through Standardese that I was previously unfamiliar with. WG21-N5032 [dcl.init.aggr]/5:The phrase "copy-initialized from an empty initializer list" is what rejects
explicitdefault ctors.Interestingly, the Standard requires forward-or-stronger iterators to be default-constructible, but only explicitly.
[forward.iterators]/1.2 "A class or pointer type
Xmeets the Cpp17ForwardIterator requirements if [...]Xmeets the Cpp17DefaultConstructible requirements", then [tab:cpp17.defaultconstructible] requires onlyT t;,T u{};,T(),T{}.We can fix our code by adding DMIs to activate [dcl.init.aggr]/5.1, which is a good idea in any event (helps avoid garbage-init).
Related: notepad-plus-plus/notepad-plus-plus#17816