[Bug libstdc++/115846] std::optional<std::unique_ptr<int>> is constant expression even in C++20 mode
pinskia at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Tue Jul 9 17:46:47 GMT 2024
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115846
--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Note here is a more reduced and easier to understand testcase (use a custom
class ratehr than unique_ptr):
```
#include <optional>
struct f
{
~f(){}
};
// static_assert([] {
// f p; // non-constant condition for static assertion
// return true;
// }());
static_assert([] {
std::optional<f> opt;
opt.reset();
return true;
}());
```
More information about the Gcc-bugs
mailing list