Skip to content

Vector2/3 and other types not usable in constexpr functions #2046

Description

@marcozee03

Godot version

4.7

godot-cpp version

10.0.0-rc1

System information

Arch Linux

Issue description

Unlike the module api. Types such as Vector2, Vector3, Transform3D, etc... are not treated as literal types and cannot be used inside of constexpr functions

Steps to reproduce

This snippet of code compiles in a module but not a gdextension

struct MyVector
{
    float x = 0;
    float y = 0;
    float z = 0;
};
constexpr MyVector to_my_vector(Vector3 other_vector)
{
    MyVector my_vector;
    my_vector.x = other_vector.x;
    my_vector.y = other_vector.y;
    my_vector.z = other_vector.z;
    return my_vector;
}

Minimal reproduction project

N/A

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementThis is an enhancement on the current functionality

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions