At the moment, you can create a partially instantiated data structure, but you can’t fill in the holes. The reason is that the code that does the filling in must temporarily alias two variables together, and the current mode checker does not allow this. This limitation will go away in the future.
foo.c:45: initializer is not computable at load time
You’re using an old version of ‘gcc’. Check that the version of ‘gcc’ in your PATH is version 2.6.3 or later. Mercury does not (at the current time) support versions of gcc earlier than 2.6.3. (Using the ‘--no-static-ground-terms’ option may also solve this problem, but results in less efficient code.)