Skip to content

ImageFormatLoaderExtension::_load_image's image parameter is const #1926

@Spartan322

Description

@Spartan322

Godot version

4.6.stable

godot-cpp version

10.0.0-rc1

System information

Godot v4.6.stable - Arch Linux #1 ZEN SMP PREEMPT_DYNAMIC Sun, 18 Jan 2026 00:33:55 +0000 on X11 - X11 display driver, Multi-window, 1 monitor - Vulkan (Forward+) - dedicated AMD Radeon RX 6600 XT (RADV NAVI23) - AMD Ryzen 5 2600 Six-Core Processor (12 threads) - 31.26 GiB memory

Issue description

ImageFormatLoaderExtension::_load_image's image parameter is const meaning in order to actually assign anything to the image parameter you need to const_cast away the image parameter's const. This appears to be a major oversight with the class for GDExtensions that has no effect in GDScript, I presume this is a consequence of how Godot handles binding the GDVIRTUAL macro declarations.

This makes this class unintuitive and as a C++ developer having a const_cast casting away const is precarious as its undefined behavior and stands against most if not all common guidelines and standards regarding C++.

Steps to reproduce

N/A

Minimal reproduction project

N/A

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugThis has been identified as a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions