% vim: ts=4 et
%
% This test cases exhibits a bug in the high-level C backend in rotd-2008-01-15 and before.
%
% Compiling with:
% mmc --grade hlc.gc --no-inlining --no-line-numbers
%
% results in invalid C code:
%
% bad_static_data.c:245: error: braced-group within expression allowed only inside a function
% bad_static_data.c:245: error: initializer element is not constant
% bad_static_data.c:245: error: (near initialization for `bad_static_data__const_1_0_0_V_3_3[0]')
%
% The same code works with the low-level C backend.
%
:- module bad_static_data.
:- interface.
:- import_module io.
:- pred main(io::di, io::uo) is det.
:- implementation.
:- import_module list.
:- import_module maybe.
:- import_module exception.

main(!IO) :-
    problem(X), 
    io.write(X, !IO).

:- pred problem(zt_float::out) is det.

problem(Output) :-
    zblt_decl_par_float(Output, yes(fc(3.0))).

:- type zt_float
    --->    fc(float).

:- pred zblt_decl_par_float(zt_float::out, maybe(zt_float)::in) is det.

zblt_decl_par_float(V, MaybeAssignE) :-
    (
        MaybeAssignE = no,
        throw("zblt_decl_par_float: par int without assignment")
    ;
        MaybeAssignE = yes(E),
        V = E
    ).
