Repository navigation
Commit 6fb1dbd
Use a checked cast where the ABI type is a real base
The previous change assumed every ABI type derives from unknown_abi, which
is false for classic COM interfaces: they derive from ::IUnknown and are
layout compatible but unrelated, so a static_cast does not compile. That
broke the test projects, which implement ICapture and IMoreDerived.
impl::abi_cast picks static_cast when a conversion exists and falls back to
reinterpret_cast otherwise. C4946 only fires for related classes, so the
fallback is silent and the warning is still gone. Applied to both to_abi
overloads as well, which have the same problem in reverse: producer derives
from the interface for classic COM but holds its vtable by value for WinRT.
Also brace the name_v terminator array, which only compiles on that path.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: b396c800-f1bf-4ba4-a50f-a7f91d4d4f94
Hostname: ManJump91 parent 334e525 commit 6fb1dbd
2 files changed
Lines changed: 22 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
468 | 468 | | |
469 | 469 | | |
470 | 470 | | |
471 | | - | |
| 471 | + | |
472 | 472 | | |
473 | 473 | | |
474 | 474 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
232 | 232 | | |
233 | 233 | | |
234 | 234 | | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
235 | 253 | | |
236 | 254 | | |
237 | 255 | | |
| |||
257 | 275 | | |
258 | 276 | | |
259 | 277 | | |
260 | | - | |
| 278 | + | |
261 | 279 | | |
262 | 280 | | |
263 | 281 | | |
264 | 282 | | |
265 | 283 | | |
266 | | - | |
| 284 | + | |
267 | 285 | | |
268 | 286 | | |
269 | 287 | | |
| |||
1568 | 1586 | | |
1569 | 1587 | | |
1570 | 1588 | | |
1571 | | - | |
| 1589 | + | |
1572 | 1590 | | |
1573 | 1591 | | |
1574 | 1592 | | |
| |||
0 commit comments