In case you haven't already fixed this, here's a patch to add support for if statements and function calls inside constant functions, plus a couple of regression tests. The tests don't require any special flags or gold files.
Proposed compiler patch
Regression tests to add to test suite
I also added the tests to the ivtest suite.
Applied to git master.