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

            Bug ID: 101486
           Summary: Rejects valid qualification conversion involving array
                    of unknown bound in function template argument [P0388]
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: leni536 at gmail dot com
  Target Milestone: ---

Version:

g++
(Compiler-Explorer-Build-gcc-48e8a7a677b8356df946cd12fbb215538828e747-binutils-2.36.1)
12.0.0 20210707 (experimental)

Flags: -std=c++20 -pedantic-errors

Observed behavior:

Rejects the following code:

```
template <typename T>
void f1(const T(*)[10]);

template <typename T>
void f2(T(*)[]);

void bar(int (*ptr)[10]) {
    f1(ptr); // accepts
    f2(ptr); // rejects
}
```

Expected behavior:

Accept both function calls. Qualification conversions are allowed when deducing
template arguments in a pointer function parameter
(https://timsong-cpp.github.io/cppwp/n4868/temp.deduct#call-4.2). As of C++20
(P0388) converting `int (*)[10]` to `int (*)[]` is a valid qualification
conversion.

Exhibits:

https://godbolt.org/z/rcbMhEf45

Reply via email to