[Bug c++/118775] [12/13/14/15 Regression] ICE in tree_to_uhwi with unique_ptr and addresss of var converted to an integer
mpolacek at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Thu Feb 6 21:56:20 GMT 2025
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118775
Marek Polacek <mpolacek at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords|needs-reduction |
--- Comment #2 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
namespace std {
struct __uniq_ptr_impl {
constexpr __uniq_ptr_impl(char *) {}
};
template <typename> struct unique_ptr {
__uniq_ptr_impl _M_t;
constexpr ~unique_ptr() {}
};
template <typename> struct _MakeUniq;
template <typename _Tp> struct _MakeUniq<_Tp[]> {
typedef unique_ptr<_Tp[]> __array;
};
template <typename _Tp> using __unique_ptr_array_t = _MakeUniq<_Tp>::__array;
constexpr __unique_ptr_array_t<char[]> make_unique(long __num) {
return unique_ptr<char[]>(new char[__num]);
}
} // namespace std
int a;
int main() { std::unique_ptr p = std::make_unique((long)&a); }
More information about the Gcc-bugs
mailing list