Re: [Patch] Fix variant::operator= on references

2016-09-22 Thread Jonathan Wakely
On 22/09/16 03:40 -0700, Tim Shen wrote: On Thu, Sep 22, 2016 at 3:36 AM, Tim Shen wrote: Then my question is, what about type traits uses like is_copy_constructible? I have seen non-qualified uses in std::any and std::optional and other places. Should all of them be qualified? Ah never mind,

Re: [Patch] Fix variant::operator= on references

2016-09-22 Thread Tim Shen
On Thu, Sep 22, 2016 at 3:36 AM, Tim Shen wrote: > Then my question is, what about type traits uses like > is_copy_constructible? I have seen non-qualified uses in std::any and > std::optional and other places. Should all of them be qualified? Ah never mind, I realized that *usually* a type trait

Re: [Patch] Fix variant::operator= on references

2016-09-22 Thread Tim Shen
On Thu, Sep 22, 2016 at 3:03 AM, Jonathan Wakely wrote: > On 22/09/16 01:49 -0700, Tim Shen wrote: >> >> Done. When writing the initial version, I was trying to save as much >> qualifications as possible (as long as the semantic doesn't change) >> for readability, but that might not be a good idea

Re: [Patch] Fix variant::operator= on references

2016-09-22 Thread Ville Voutilainen
On 22 September 2016 at 13:03, Jonathan Wakely wrote: > On 22/09/16 01:49 -0700, Tim Shen wrote: >> >> Done. When writing the initial version, I was trying to save as much >> qualifications as possible (as long as the semantic doesn't change) >> for readability, but that might not be a good idea.

Re: [Patch] Fix variant::operator= on references

2016-09-22 Thread Jonathan Wakely
On 22/09/16 01:49 -0700, Tim Shen wrote: Done. When writing the initial version, I was trying to save as much qualifications as possible (as long as the semantic doesn't change) for readability, but that might not be a good idea. It does change the semantics, as forward<_Tp>(__tp) can find anot

Re: [Patch] Fix variant::operator= on references

2016-09-22 Thread Tim Shen
On Thu, Sep 22, 2016 at 1:39 AM, Jonathan Wakely wrote: > Please qualify std::forward here. Done. When writing the initial version, I was trying to save as much qualifications as possible (as long as the semantic doesn't change) for readability, but that might not be a good idea. > > OK for trun

Re: [Patch] Fix variant::operator= on references

2016-09-22 Thread Jonathan Wakely
On 22/09/16 00:43 -0700, Tim Shen wrote: Hi, this patch fixes the following compilation failure: #include int main() { float f1 = 1.0f, f2 = 2.0f; std::variant v1(f1); v1 = f2; // #1 } The bug is caused by a misuse of __storage. I also examined other __storage usage, they all seem app

Re: [Patch] Fix variant::operator= on references

2016-09-22 Thread Tim Shen
On Thu, Sep 22, 2016 at 12:43 AM, Tim Shen wrote: > Hi, this patch fixes the following compilation failure: For the record, the bug is found by Ville. Thank you Ville! :) -- Regards, Tim Shen