Boost logo

Boost Users :

Subject: [Boost-users] Bug when using boost::optional with boost::program_options?
From: Jim Porter (jvp4846_at_[hidden])
Date: 2018-06-02 04:53:06


Before I spend too long tracking this down (I'm only seeing it in an
Appveyor Windows build, since I do most of my work on Linux), I wanted
to see if anyone else has experienced this issue. I'm trying to use
boost::program_options to parse a command line arg and store it into a
boost::optional, however I get a surprising compilation error[1].

This appears to have been introduced sometime between Boost 1.60 and
1.62 (Appveyor doesn't have Boost 1.61). I see that there were some
significant changes to boost::optional between those revisions, so maybe
that's the cause? The following test case *might* reproduce the issue,
but sadly, rextester only has Boost 1.60, so it works there[2]. If it
fails for someone with Boost 1.62+, then great! (Well, not "great", but
you know what I mean.)

Interestingly, it's not until Boost 1.65[3] that boost::program_options
claims to support storing values into boost::optional; it's worked for
me since long before that, possibly because I `#include
<boost/optional/optional_io.hpp>`.

If this isn't enough for others to help confirm this issue, that's ok;
I'll try to get a Windows dev environment set up to provide more details
in the coming week. I just wanted to send this out before I forgot about
it...

If it matters, the Appveyor build I'm seeing this with uses Visual
Studio 2015 Update 3.

Thanks,
- Jim

[1] https://hastebin.com/awutivawew.txt
[2] http://rextester.com/QGBH48883
[3] https://www.boost.org/users/history/version_1_65_0.html


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