Repository navigation
Commit 94787ce
committed
Add a guid constructor overload taking Data4 by reference to array
The guid constructor takes Data4 as std::array<std::uint8_t, 8> const&.
Because std::array wraps a C array, a braced call site elides the inner
braces and MSVC reports C5246, "the initialization of a subobject should be
wrapped in braces", at every such call site - including the guid literals
C++/WinRT generates for each namespace header.
Suppressing the warning around the constructor does not work, because the
diagnostic is attributed to the caller rather than to the constructor.
Add an overload taking std::uint8_t const (&)[8] rather than replacing the
existing parameter. A braced initializer then binds to the C array directly,
with no intervening subobject and no warning, while callers passing a
std::array continue to compile unchanged.
Measured on a /Wall build of a translation unit exercising collections,
coroutines, delegates, implements, factories and classic COM: C5246 falls
from 114 to 20, with no other diagnostic changes.1 parent 856eaff commit 94787ce
1 file changed
Lines changed: 8 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
140 | 140 | | |
141 | 141 | | |
142 | 142 | | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
143 | 151 | | |
144 | 152 | | |
145 | 153 | | |
| |||
0 commit comments