From 5a9ef35199c1e4c52294e5f9a563877aa2925a1b Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Tue, 1 Oct 2024 17:10:00 +0900 Subject: [PATCH] [qfcc] Add constexpr initializers to the ctor list So far, this affects only glsl (because only glsl marks expressions as constexpr), but it does get specialization constant initializers for global variables working. --- tools/qfcc/source/def.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tools/qfcc/source/def.c b/tools/qfcc/source/def.c index c9121e712..10d248f78 100644 --- a/tools/qfcc/source/def.c +++ b/tools/qfcc/source/def.c @@ -637,6 +637,9 @@ initialize_def (symbol_t *sym, const expr_t *init, defspace_t *space, init = assign_expr (new_symbol_expr (sym), init); // fold_constants takes care of int/float conversions append_expr (local_expr, fold_constants (init)); + } else if (is_constexpr (init)) { + init = assign_expr (new_symbol_expr (sym), init); + add_ctor_expr (init); } else { if (!is_constant (init)) { error (init, "non-constant initializier");