https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79743
Bug ID: 79743 Summary: std::experimental::optional<boolean> constructor broken in gcc 6.2 Product: gcc Version: lto Status: UNCONFIRMED Severity: normal Priority: P3 Component: libstdc++ Assignee: unassigned at gcc dot gnu.org Reporter: krisk0.2017.02.27 at protonmail dot com Target Milestone: --- Created attachment 40841 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=40841&action=edit all files mentioned in bug-report Short story: std::experimental::optional<boolean> copy-constructor is broken under GCC 6.2. 47-line .cpp proves it. Long story as required by https://gcc.gnu.org/bugs/: * the exact version of GCC sys-devel/gcc-5.3.0 --- works fine sys-devel/gcc-6.2.0 --- buggy * the system type Gentoo on amd64 (Intel Core i5) * the options given when GCC was configured/built See files 5.3.configure and 6.2.configure * the complete command line that triggers the bug Install Google test --- package dev-cpp/gtest; g++ -std=c++14 -O2 -lgtest test.cpp && ./a.out Test passes under gcc 5.3 and fails under 6.2. std::experimental::optional<boolean> constructor sets butter to false though it should be undefined. * the compiler output (error messages, warnings) None * the preprocessed file (*.i*) test.5.3.ii --- works fine, test passes test.6.2.ii --- test fails ``` test.cpp:40: Failure Value of: !s1.butter Actual: false Expected: true test.cpp:40: Failure Value of: Nothing Actual: 1-byte object <00> Expected: s1.butter Which is: 2-byte object <00-01> ```