-
Notifications
You must be signed in to change notification settings - Fork 89
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #175 from k3DW/feature/empty-value-inherit-public
Fix `empty_value` MSVC bug
Showing
4 changed files
with
106 additions
and
5 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// Copyright 2024 Braden Ganetsky | ||
// Distributed under the Boost Software License, Version 1.0. | ||
// https://www.boost.org/LICENSE_1_0.txt | ||
|
||
#include <boost/core/empty_value.hpp> | ||
|
||
struct empty {}; | ||
|
||
// This test ensures private inheritance of `boost::empty_value<T>` for empty `T`. | ||
// With public inheritance, `boost::empty_value<empty>*` could cast to `empty*`. | ||
void test_empty_not_convertible_to_base() | ||
{ | ||
const boost::empty_value<empty> x(boost::empty_init); | ||
const empty* x2 = static_cast<const empty*>(&x); | ||
(void)x2; | ||
} | ||
|
||
int main() | ||
{ | ||
} |
This file contains 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