Skip to content

Static array initialization with single element misdetected as direct construction via sret #1548

@puffi

Description

@puffi

The following code results in "Call parameter type does not match function signature!" error when building with ldc2 on Arch Linux.

LDC - the LLVM D compiler (1.0.0):
  based on DMD v2.070.2 and LLVM 3.8.0
  built with DMD64 D Compiler v2.071.0

No flags passed to ldc2, only the source file.

void main()
{
    mat4[1024] transforms = mat4.identity;
}

struct mat4
{
    float[16] data;

    static @property auto identity()
    {
        return mat4(
            [1, 0, 0, 0,
             0, 1, 0, 0,
             0, 0, 1, 0,
             0, 0, 0, 1]
        );
    }
}

The whole error message:

Call parameter type does not match function signature!
  %transforms = alloca [1024 x %app.mat4], align 4
 %app.mat4*  call void @_D3app4mat48identityFNaNbNdNiNfZS3app4mat4([1024 x %app.mat4]* noalias sret align 4 %transforms)
LLVM ERROR: Broken function found, compilation aborted!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions