Last active
December 15, 2015 07:59
-
-
Save komiga/5227043 to your computer and use it in GitHub Desktop.
Broke the Clangmaster. Again.
This file contains hidden or 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
| #include <cstddef> | |
| using E = int; | |
| using U = E[]; | |
| struct H { | |
| E b[1]{E{1}}; | |
| U const& ref{reinterpret_cast<U const&>(b)}; | |
| operator U const&() const { | |
| return reinterpret_cast<U const&>(b); | |
| } | |
| }; | |
| signed main() { | |
| H const h{}; | |
| // Works with h.ref | |
| U const& ref{h}; | |
| return 0; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment