[Bug libstdc++/79743] std::experimental::optional constructor broken in gcc 6.2

2017-03-02 Thread krisk0.2017.02.27 at protonmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79743

--- Comment #2 from Денис Крыськов  ---
ok, will provided standalone .cpp next time.

Jonathan, thank you.

[Bug libstdc++/79743] std::experimental::optional constructor broken in gcc 6.2

2017-03-01 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79743

Jonathan Wakely  changed:

   What|Removed |Added

 Status|UNCONFIRMED |RESOLVED
 Resolution|--- |DUPLICATE

--- Comment #1 from Jonathan Wakely  ---
(In reply to Денис Крыськов from comment #0)
> all files mentioned in bug-report

No, because you haven't provided a standalone program that can be compiled,
because it includes gtest headers.

Here's a standalone version, which fails with 6.2 and passes with 6.3:

#include 
#include 
#include 

class Bread_and_butter {
public:
std::string bread;
std::experimental::optional butter;

Bread_and_butter(Bread_and_butter&& source);
Bread_and_butter() noexcept : bread(), butter() {};
Bread_and_butter(const Bread_and_butter&) = delete;
Bread_and_butter& operator=(const Bread_and_butter&) = delete;
Bread_and_butter& operator=(Bread_and_butter&&) = delete;
};

Bread_and_butter::Bread_and_butter(Bread_and_butter&& source) :
bread(source.bread),
butter(source.butter) {
if(bread.size() >= 5) {
butter = true;
}
if(bread.size() >= 10) {
butter = false;
}
}

int main() {
Bread_and_butter s0;
auto s1 = std::move(s0);
assert(!s1.butter);
}

I think this is a dup of PR 77288

*** This bug has been marked as a duplicate of bug 77288 ***