[variant] Possible regression from 1.55 to 1.58
Hi.
I just upgraded my Boost from 1.55 to 1.58. My project doesn't build
anymore, it fails on the following pattern, which used to work with 1.55:
---<snip>---
#include <algorithm>
#include
On 11 August 2015 at 11:46, Mario Lang
Hi.
The example is a bit silly, since foreach discards the return value of apply_visitor anyway. So my solution was to change the visitor to define result_type as void. This works. However, I am wondering why delayed_visitor does no longer work in this situation? Is it because I am trying to return a reference?
Could you also tell us which compiler and OS you're using and what the compiler error is? -- Maarten
On Tue, Aug 11, 2015 at 5:46 AM, Mario Lang
The example is a bit silly, since foreach discards the return value of apply_visitor anyway. So my solution was to change the visitor to define result_type as void. This works. However, I am wondering why delayed_visitor does no longer work in this situation? Is it because I am trying to return a reference?
I believe this is caused by a bug in the trait used to detect whether result_type is present. It used to form a pointer to result_type, and pointer to references are ill-formed, so the trait reports that result_type doesn't exist, and then the overloads of apply_visitor do not SFINAE correctly. The bug has been fixed in https://github.com/boostorg/variant/commit/aad58b5fe5b2605bf752c8151ae0539df... . Tim
Tim Song
On Tue, Aug 11, 2015 at 5:46 AM, Mario Lang
wrote: The example is a bit silly, since foreach discards the return value of apply_visitor anyway. So my solution was to change the visitor to define result_type as void. This works. However, I am wondering why delayed_visitor does no longer work in this situation? Is it because I am trying to return a reference?
I believe this is caused by a bug in the trait used to detect whether result_type is present. It used to form a pointer to result_type, and pointer to references are ill-formed, so the trait reports that result_type doesn't exist, and then the overloads of apply_visitor do not SFINAE correctly.
Sounds about right, thanks for the hint!
The bug has been fixed in https://github.com/boostorg/variant/commit/aad58b5fe5b2605bf752c8151ae0539df...
So I guess this would be fixed with 1.59 then? -- CYa, ⡍⠁⠗⠊⠕
-----Original Message----- From: Boost-users [mailto:boost-users-bounces@lists.boost.org] On Behalf Of Mario Lang Sent: Tuesday, August 11, 2015 7:54 PM To: boost-users@lists.boost.org Subject: Re: [Boost-users] [variant] Possible regression from 1.55 to 1.58
Tim Song
writes: On Tue, Aug 11, 2015 at 5:46 AM, Mario Lang
wrote: The example is a bit silly, since foreach discards the return value of apply_visitor anyway. So my solution was to change the visitor to define result_type as void. This works. However, I am wondering why delayed_visitor does no longer work in this situation? Is it because I am trying to return a reference?
I believe this is caused by a bug in the trait used to detect whether result_type is present. It used to form a pointer to result_type, and pointer to references are ill-formed, so the trait reports that result_type doesn't exist, and then the overloads of apply_visitor do not SFINAE correctly.
Sounds about right, thanks for the hint!
The bug has been fixed in
https://github.com/boostorg/variant/commit/aad58b5fe5b2605bf752c8151ae
0539df98223f9
So I guess this would be fixed with 1.59 then?
It's hard to tell. I took a quick look at GitHub (https://github.com/boostorg/variant) , and there doesn't appear to be any tags for the 1.59.0 release candidates. Assuming that 1.59 the latest release candidate is the tip of the master branch, then I can see that on June 17th the patch is applied. https://github.com/boostorg/variant/compare/boost-1.58.0...master Shane Turner ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ This e-mail is intended only for the named recipient(s) and may contain information that is otherwise privileged, confidential and/or exempt from disclosure under applicable law. No waiver of privilege, confidence, or otherwise is intended by virtue of communication via the internet. Any unauthorized use, dissemination or copying is strictly prohibited. If you have received this e-mail in error, or are not the named as a recipient, please immediately notify the sender and destroy all copies of this e-mail. ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
participants (4)
-
Maarten de Vries
-
Mario Lang
-
Shane Turner
-
Tim Song