On Dec 29, 2020, Mike Stump <mikest...@comcast.net> wrote:

>   a[i-1] = i;

'fraid that won't pass:

    for (int i = 0; i < n; i++) {
        assert (a[i] == i);
    }


we could make it:

    a[i-1] = i-1;

but...  yuck.

IMHO it's a lot less surprising to have an init loop that matches the check.


>> +++ b/gcc/testsuite/g++.dg/cpp1y/constexpr-66093.C
>> @@ -19,7 +19,7 @@ private:
>> 
>> constexpr A f() {
>> A a{};
>> -    for (int i = 1; i <= n; i++) {
>> +    for (int i = 0; i < n; i++) {
>> a[i] = i;
>> }
>> return a;

-- 
Alexandre Oliva, happy hacker  https://FSFLA.org/blogs/lxo/
   Free Software Activist         GNU Toolchain Engineer
        Vim, Vi, Voltei pro Emacs -- GNUlius Caesar

Reply via email to