[PATCH] D152003: [clang] Fix `static_cast` to array of unknown bound
Mark de Wever via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Jul 25 08:35:18 PDT 2023
Mordante added a comment.
In D152003#4531404 <https://reviews.llvm.org/D152003#4531404>, @Fznamznon wrote:
>> should we try to land that today?
>
> I'm not sure. It causes failures in libc++ testing:
>
> Failed Tests (3):
> llvm-libc++-shared.cfg.in :: std/ranges/range.access/end.pass.cpp
> llvm-libc++-shared.cfg.in :: std/ranges/range.access/rbegin.pass.cpp
> llvm-libc++-shared.cfg.in :: std/ranges/range.access/rend.pass.cpp
>
> I haven't figured out why. Trying to compile:
>
> #include <ranges>
>
> using RangeCREndT = decltype(std::ranges::crend);
> static_assert(!std::is_invocable_v<RangeCREndT, int (&)[]>);
>
> fails with this patch only using libc++, libstdc++ is fine. I'm not sure it is my misunderstanding, bug in the patch or bug in libc++.
What do you mean with libstdc++ is fine?
The reduced tests passed with libcstd++ https://godbolt.org/z/nh9v8cedr
The change seems to break libc++.
Based on the bug and this patch I am correct that "transformation" of an array of unknown bounds to anarray of known bounds only happens with an explicit cast and not implicitly?
I have a strong suspicion that this patch changes the test to
#include <ranges>
using RangeCREndT = decltype(std::ranges::crend);
static_assert(!std::is_invocable_v<RangeCREndT, int (&)[1]>); // no longer an array of unknown bound so the assert fails
Can you look at the AST output of the failed example to verify my hypothesis? When you think libc++ is wrong can you then post this AST?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D152003/new/
https://reviews.llvm.org/D152003
More information about the cfe-commits
mailing list