Skip to content

Clang-cl: cannot mangle this matrix type yet #53158

Open
@DoDoENT

Description

@DoDoENT

Trying to compile this simple C++ program:

#include <new>

template < int height, int width, typename T = float >
struct alignas( 16 ) FixedSizedMatrix
{
    using M = float __attribute__(( matrix_type( 3, 3 ) ));
    using value_type = T;
	
    M m;

    FixedSizedMatrix( M && source ) noexcept { m = source; }
	
    auto data() const noexcept { return reinterpret_cast< T const * >( &m ); }
    auto data()       noexcept { return reinterpret_cast< T       * >( &m ); }

    template < typename ... Values >
    FixedSizedMatrix( Values ... values ) noexcept
    {
        static_assert( sizeof...( values ) == height * width );
        using Array = value_type[ height * width ];
        new ( data() ) Array{ static_cast< value_type >( values )..., };
    }
};

int main()
{
	FixedSizedMatrix< 2, 2 > m{ 1.f, 2.f, 3.f, 4.f };
	FixedSizedMatrix< 2, 2 > n{ __builtin_matrix_transpose( m.m ) };
	return 0;
}

on windows using:

clang-cl /clang:-fenable-matrix /clang:-std=gnu++2a test.cpp

fails with the following error:

test.cpp(11,2): error: Cannot mangle this matrix type yet
        FixedSizedMatrix( M && source ) noexcept { m = source; }
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.

The problem is caused by MicrosoftMangle.cpp not having implementation for Microsoft mangling of clang matrix types.

Are there any plans to implement this?

While adding the feature for Itanium mangler, there was quite a discussion on how to implement correct mangling of such types, however, MS mangler was completely ignored.

I'm aware that no such thing exists in MSVC and that that was probably the reason for not implementing it, but could this be a good enough reason for LLVM guys to "invent" mangling of such types for MS mangler, even if this means accepting that such functions will only be consumable by clang compilers?

Metadata

Metadata

Assignees

No one assigned

    Labels

    clang-cl`clang-cl` driver. Don't use for other compiler parts

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions