[clang] [Clang][Sema] placement new initializes typedef array with correct size (PR #83124)

Erich Keane via cfe-commits cfe-commits at lists.llvm.org
Wed Apr 17 06:16:46 PDT 2024


erichkeane wrote:

> Unless the original test was subtly broken, the forward fix in [0a789ea](https://github.com/llvm/llvm-project/commit/0a789ea8a829da345e46d8224d73b2ddaba6969f) seems erroneous.
> 
> The forward fix changes the test to have a different declaration of `new`. But I would not expect this original change to require source-code level changes. Or was that intended?
> 
> We are experiencing errors that look like this:
> 
> ```
> [foo.cc:1045] error: no matching member function for call to 'reset'
>  1045 |   values_remaining_at_rank_of_width_.reset(new int64_t[ranks][65]);
>       |   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~
> [foo.cc:1784] note: in instantiation of member function '(anonymous namespace)::Writer<unsigned long>::InitStats' requested here
>  1784 |   InitStats();
>       |   ^
> [foo.cc:2045] note: in instantiation of member function '(anonymous namespace)::Writer<unsigned long>::DoIt' requested here
>  2045 |   writer.DoIt();
>       |          ^
> [.../toolchain/bin/../include/c++/v1/__memory/unique_ptr.h:487] note: candidate template ignored: requirement '_CheckArrayPointerConversion<long *>::value' was not satisfied [with _Pp = int64_t *]
>   487 |   _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 void reset(_Pp __p) _NOEXCEPT {
>       |                                                            ^
> ```

That forward-fix was just a test change, doing a #include in our tests isn't something we can do, as it makes them fail with "file not found".  As far as your errors, it shouldn't be because of those, but could definitely be a problem wiht the originnal patch, hopefully @mahtohappy can get a chance to look at this.

https://github.com/llvm/llvm-project/pull/83124


More information about the cfe-commits mailing list