On Sat, Sep 3, 2016 at 12:46 PM, Mikhail Strelnikov wrote:
> Hello,
>
> Following code does not compile,
>
> #include
>
> namespace n
> {
> template
> void operator&(T) {}
> struct s{};
> }
>
> int main()
> {
> std::variant v;
> std::get(v);
> }
>
> error: include/c++/7.0.0/variant:315:4: error: invalid static_cast
>
> diff -r -u a/libstdc++-v3/include/std/variant
> b/libstdc++-v3/include/std/variant
> --- a/libstdc++-v3/include/std/variant 2016-08-26 13:34:30.823029400 +0300
> +++ b/libstdc++-v3/include/std/variant 2016-09-03 18:01:26.431299300 +0300
> @@ -312,7 +312,7 @@
>_M_storage() const
>{
> return const_cast(
> - static_cast(&_M_first._M_storage));
> + static_cast(std::__addressof(_M_first._M_storage)));
>}
>
>union
Thanks for the patch! Tested on x86_64-linux-gnu and committed as r239996.
I changed std::__addressof to std::addressof since it's standardized
since C++11.
--
Regards,
Tim Shen