Array of Enum not constant in Godot 4?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By rakkarage
enum Test {
	Furst, Second, Third, Fouth, Fifth
}

const _array := [Test.First, Test.Second]

Initializer for a constant must be a constant expression.

This used to work in Godot 3. I can fix it by changing const to var but… maybe a bug?

this gives the error too so idk

const _fovOctants = [
[1,  0,  0, -1, -1,  0,  0,  1],
[0,  1, -1,  0,  0, -1,  1,  0],
[0,  1,  1,  0,  0, -1, -1,  0],
[1,  0,  0,  1, -1,  0,  0, -1]
]

rakkarage | 2022-02-04 18:28

I ran into potentially the same issue when I updated to Godot 4:

const colorList = PackedColorArray([ 
Color(0.12, 0.12, 0.12), # 0 - black
Color(0.12, 1.0, 0.12),  # 1 - green
Color(1.0, 0.12, 0.12),  # 2 - red
Color(0.12, 0.12, 1.0),  # 3 - blue
Color(0.79, 0.79, 0.12)  # 4 - yellow
])

Gives the error:
“Assigned value for constant “colorList” isn’t a constant expression.”

kwhans | 2023-03-16 13:18