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

            Bug ID: 111511
           Summary: Incorrect ADL in std::to_array in GCC 11/12/13
           Product: gcc
           Version: 13.2.1
            Status: UNCONFIRMED
          Keywords: rejects-valid
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: de34 at live dot cn
  Target Milestone: ---

The following program is incorrectly rejected when using libstdc++
(https://godbolt.org/z/x6K6r5svM).

```
#include <array>
#include <utility>

struct incomplete;

template<class T>
struct holder {
    T t;
};

using validator = holder<incomplete>*;

int main()
{
    validator a[1]{};
    (void) std::to_array(a);
    (void) std::to_array(std::move(a));
}
```

The error is caused by aunqualified calls to the `__to_array` internal
function, which triggers ADL for `incomplete` and requires it to be complete.

Not sure whether this should be WONTFIX since the implementation is
fundamentally changed in GCC 14 (PR 110167).

Reply via email to