Boost logo

Boost Users :

Subject: Re: [Boost-users] [variant] Possible regression from 1.55 to 1.58
From: Tim Song (t.canens.cpp_at_[hidden])
Date: 2015-08-11 14:42:36


On Tue, Aug 11, 2015 at 5:46 AM, Mario Lang <mlang_at_[hidden]> 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.

The bug has been fixed in
https://github.com/boostorg/variant/commit/aad58b5fe5b2605bf752c8151ae0539df98223f9
.

Tim



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net