| 1 | // Copyright (c) 2023 Bela Schaum, X-Ryl669, Denis Mikhailov. |
| 2 | // |
| 3 | // Distributed under the Boost Software License, Version 1.0. (See accompanying |
| 4 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) |
| 5 | |
| 6 | |
| 7 | // Initial implementation by Bela Schaum, https://github.com/schaumb |
| 8 | // The way to make it union and UB free by X-Ryl669, https://github.com/X-Ryl669 |
| 9 | // |
| 10 | |
| 11 | template <auto p> |
| 12 | class X {}; |
| 13 | |
| 14 | template <class T> |
| 15 | struct Store |
| 16 | { |
| 17 | T v; |
| 18 | }; |
| 19 | |
| 20 | template <class T> |
| 21 | Store(T) -> Store<T>; |
| 22 | |
| 23 | struct S |
| 24 | { |
| 25 | int m; |
| 26 | } s; |
| 27 | |
| 28 | X<Store{&s.m}> x4; |
| 29 | |
| 30 | int main() {} |
| 31 | |
| 32 | |
| 33 | |