Skip to content

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

Closed

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

Activity

  1. marcozee03 commented on Aug 19, 2026

    @marcozee03
    ContributorAuthor

    I was poking around previous versions and learned that the vector and other math types are just out of sync. since 4.6 introduced that change. so the files from this commit would need to be updated. Unless this somehow breaks compatibility I could create the pr.

  2. Ivorforce commented on Aug 19, 2026

    @Ivorforce
    Member

    Yea, if it's already fixed upstream syncing the changes over is fair game. Feel free to open a PR for it!

  3. added
    enhancement
    on Aug 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions