[qfcc] Check const_initializers option for constexpr

This is probably not right for spir-v, but it fixes initialized defs in
switch case labels (qc legacy with the defs).
This commit is contained in:
Bill Currie 2025-01-18 16:04:42 +09:00
parent 2cf14e13ec
commit 2c204d40b2

View file

@ -623,7 +623,7 @@ 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 (block, fold_constants (init));
} else if (is_constexpr (init)) {
} else if (!options.code.const_initializers && is_constexpr (init)) {
init = assign_expr (new_symbol_expr (sym), init);
add_ctor_expr (init);
} else {