slackito wrote:

The following program fails to build after this change:
```
#include <cstdint>
#include <memory>

template<typename T>
struct X {
  void f() {
    values_.reset(new int64_t[123][65]);
  }

  std::unique_ptr<int64_t[][65]> values_;
};

int main() {
  X<unsigned char> x;
  x.f();
}
```
you get similar errors with both libstdc++:
```
jgorbe@gorbe:~/llvm-build/bin$ ./clang++ -o /dev/null ~/repro.cc
/usr/local/google/home/jgorbe/repro.cc:7:13: error: no matching member function 
for call to 'reset'
    7 |     values_.reset(new int64_t[123][65]);
      |     ~~~~~~~~^~~~~
/usr/local/google/home/jgorbe/repro.cc:15:5: note: in instantiation of member 
function 'X<unsigned char>::f' requested here
   15 |   x.f();
      |     ^
/usr/lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/unique_ptr.h:779:7:
 note: candidate template ignored: requirement 
'__and_<std::__or_<std::is_same<long *, long (*)[65]>, 
std::__and_<std::is_same<long (*)[65], long (*)[65]>, std::is_pointer<long *>, 
std::is_convertible<long (*)[], long (*)[][65]>>>>::value' was not satisfied 
[with _Up = int64_t *]
  779 |       reset(_Up __p) noexcept
      |       ^
1 error generated.
```
and libc++
```
jgorbe@gorbe:~/llvm-build/bin$ ./clang++ -o /dev/null ~/repro.cc -stdlib=libc++
/usr/local/google/home/jgorbe/repro.cc:7:13: error: no matching member function 
for call to 'reset'
    7 |     values_.reset(new int64_t[123][65]);
      |     ~~~~~~~~^~~~~
/usr/local/google/home/jgorbe/repro.cc:15:5: note: in instantiation of member 
function 'X<unsigned char>::f' requested here
   15 |   x.f();
      |     ^
/usr/local/google/home/jgorbe/llvm-build/bin/../include/c++/v1/__memory/unique_ptr.h:457:60:
 note: candidate template ignored: requirement 
'_CheckArrayPointerConversion<long *>::value' was not satisfied [with _Pp = 
int64_t *]
  457 |   _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 void reset(_Pp 
__p) _NOEXCEPT {
      |                                                            ^
1 error generated.
```

https://github.com/llvm/llvm-project/pull/83124
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to