https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104920

--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
E.g. in the above #c0 testcase, you can see it in the -fdump-tree-gimple dump:
        memset (&arr, 0, 10);
        _1 = std::array<int, 10>::data (&arr2);
        memset (_1, 0, 10);
For the arr case, the FE can see the array and the size, while for the other
case
it can only see the size to be constant (even that goes beyond what the
language guarantees, as the size is passed outside of manifestly constant
evaluated context, so nothing guarantees it is constant evaluated).
But, if you e.g. add
    constexpr auto p = arr2.data();
to your #c0 testcase, you'll see it is not a constant expression:
error: ‘(int*)(& arr2.std::array<int, 10>::_M_elems)’ is not a constant
expression

Reply via email to