[Bug c++/87016] New: std::optional::operator= in constexpr context
bobogu at atlas dot cz
gcc-bugzilla@gcc.gnu.org
Sun Aug 19 20:09:00 GMT 2018
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87016
Bug ID: 87016
Summary: std::optional::operator= in constexpr context
Product: gcc
Version: 8.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: bobogu at atlas dot cz
Target Milestone: ---
Created attachment 44558
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=44558&action=edit
preprocessed TU
According to the standard, there is no assignment operator that should work in
a constexpr context, however, I am able to successfully compile and use the
following snippet:
// gcc -lstdc++ -std=c++17 main.cpp @Linux laptop 4.17.11-arch1 x86_64
constexpr std::optional<int> foo() {
std::optional<int> bar = 3;
bar = 10;
return bar;
}
More information about the Gcc-bugs
mailing list