Skip to content

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

@languagelawyer

Description

@languagelawyer
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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions