Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Array bounds are mirrored if remove_all_extents_t<array_type> is instantiated from a template #404

Closed
languagelawyer opened this issue Jun 14, 2021 · 1 comment
Labels
bug Something isn't working

Comments

@languagelawyer
Copy link

languagelawyer commented Jun 14, 2021

struct S {};
template<typename> struct T {};

   int arr1[3][2];
     S arr2[3][2];
T<int> arr3[3][2];

becomes

struct S
{
  // inline constexpr S() noexcept = default;
};


template<typename> struct T {};

/* First instantiated from: insights.cpp:6 */
#ifdef INSIGHTS_USE_TEMPLATE
template<>
struct T<int>
{
  // inline constexpr T() noexcept = default;
};

#endif


   int arr1[3][2];

     S arr2[3][2] = S [3][2]();

T<int> arr3[2][3] = T<int>[2][3]();

Notice how arr3 abounds became mirrored. Mirroring seems to happen to any number of dimensions.

Also, even though there is construction expression in Clang AST (CXXConstructExpr <col:8> 'S [3][2]' 'void () noexcept', CXXConstructExpr <col:8> 'T<int> [3][2]' 'void () noexcept'), I don't think it should be dumped.

@languagelawyer languagelawyer changed the title Array bounds are mirrored if remove_all_extents_t<array_type> instantiated from a template Array bounds are mirrored if remove_all_extents_t<array_type> is instantiated from a template Jun 14, 2021
@andreasfertig
Copy link
Owner

Hello @languagelawyer,

unbelievable that you spotted this one. Thanks! And thank you for reporting it. Unfortunately, it comes from the implementation of the type handler InsightsHelpers.cpp. I will see how I can fix it.

Best,

Andreas

@andreasfertig andreasfertig added the bug Something isn't working label Jun 16, 2021
andreasfertig added a commit that referenced this issue Feb 5, 2022
Fixed #404: Unintentional swapping of array dimensions.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants