https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97132
--- Comment #6 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The releases/gcc-10 branch has been updated by Jonathan Wakely <r...@gcc.gnu.org>: https://gcc.gnu.org/g:90c9484b12dd8a05b5314f5cb9847df46024a194 commit r10-8913-g90c9484b12dd8a05b5314f5cb9847df46024a194 Author: Jonathan Wakely <jwak...@redhat.com> Date: Mon Sep 21 14:28:58 2020 +0100 libstdc++: Make std::assume_aligned a constexpr function [PR 97132] The cast from void* to T* in std::assume_aligned is not valid in a constexpr function. The optimization hint is redundant during constant evaluation anyway (the compiler can see the object and knows its alignment). Simply return the original pointer without applying the __builtin_assume_aligned hint to it when doing constant evaluation. libstdc++-v3/ChangeLog: PR libstdc++/97132 * include/std/memory (assume_aligned): Do not use __builtin_assume_aligned during constant evaluation. * testsuite/20_util/assume_aligned/1.cc: Improve test. * testsuite/20_util/assume_aligned/97132.cc: New test. (cherry picked from commit f10ed928e2f8ecc2c859abff8f2f9296b11b8d95)