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.
In
pair
,tuple
, andoptional
, we use C++20 conditionalexplicit
(akaexplicit(bool)
) to simplify constructors and improve compiler throughput, when compiler support is available:STL/stl/inc/optional
Lines 182 to 193 in 0cbd1b2
Like C++17
if constexpr
, MSVC supports C++20explicit(bool)
in older Standard modes, with a suppressible warning. (This is because the feature requires novel syntax, so it can't be accidentally used, and it's extremely useful to library developers.) We suppress both warnings in STL headers:STL/stl/inc/yvals_core.h
Lines 368 to 380 in 0cbd1b2
Clang 9 supported
explicit(bool)
in C++20 mode, while Clang 10 added "downlevel" support similar to MSVC. When #708 changed the STL to require Clang 10, it also began using Clang 10's downlevel support forexplicit(bool)
.@cbezault discovered that we forgot to suppress the warning that Clang emits for
explicit(bool)
in older Standard modes. We missed this because Clang (unlike MSVC) ordinarily suppresses warnings from "system headers". (-Wsystem-headers
activates warnings in system headers, although this is rarely used because users are rarely interested in such warnings, and UCRT/WinSDK headers are still being cleaned up.)This is a practical issue because anything on the
INCLUDE
path is considered to be a system header for warning purposes, while/I
directories aren't (despite#include <meow>
searching bothINCLUDE
and/I
). During STL development, it is very convenient to be able to compile with/I S:\GitHub\STL\stl\inc
and immediately consume updated STL headers without rebuilding (this is not possible when separately compiled changes are involved, of course), which will emit Clang warnings.After this lengthy backstory, the fix is delightfully simple.