Open jjjordan opened 2 years ago
Another temporary work around is to use a series of if
statements without elseif
. I will be looking into this bug, I have made some fixes to varargs in 1.9, so I'll try to get this one in there too.
This has been fixed in 27b85c8. We will probably backport this into the 1.9 release that will hopefully be out later this month.
Applies to: 1.81 & latest from master branch
Here is a short repro:
Which yields the following errors:
I found this comment (but no issue, looks like it predates this repository), however with a debugger I find that at this point, the define is gone since macro parameter substitution has already happened.
Observation: Note that not every elseif in the chain yields an error. It only seems to occur after the first
false
evaluation. i.e., for the input 'A', the first comparison is true, the second is false, and then we get errors for 'C' and 'D'. For 'B', the first comparison is false so we get errors for 'B', 'C', and 'D'. I found this counterintuitive. If we're evaluating elseif's, I would think that everyfalse
result should lead you to treat the nextelseif
as a brand-newif
and once we get atrue
then we stop caring about any further branches.Workaround/note: Assigning the variadic argument to a define and using it in further conditionals sometimes works (see below). However, in my actual project I get
Broken define declaration
errors on the workaround line. I don't have a self-contained repro for this case (yet), so imo it's worth an attempt at fixing this one.