ref: ac58fd9b83d1bb1cac2a0fb354176dd975afd94c
parent: 9f1ac5b4a1f2bb17b145c37f22bfc1b06432220e
author: Ori Bernstein <ori@eigenstate.org>
date: Sat Jan 12 16:34:53 EST 2019
Allow folding character-typed designated array inits.
--- a/parse/fold.c
+++ b/parse/fold.c
@@ -23,9 +23,13 @@
if (exprop(n) != Olit)
return 0;
l = n->expr.args[0];
- if (l->lit.littype != Lint)
+ /* It's up to type checking to make sure this is ok */
+ if (l->lit.littype == Lint)
+ *v = l->lit.intval;
+ else if (l->lit.littype == Lchr)
+ *v = l->lit.chrval;
+ else
return 0;
- *v = l->lit.intval;
return 1;
}