Files
mercury/tests/valid/bug485.m
Zoltan Somogyi a1ab0668a4 Allow foreign_enums for dummy types.
This fixes Mantis bug #485.

compiler/check_parse_tree_type_defns.m:
    Generalize the representation of du types in checked type definitions
    to give special representation to dummy types, as well as enum types.

    Allow foreign enum definitions for types whose du definitions are dummy,
    as well as those whose du definitions are enum.

compiler/prog_type.m:
    Have the predicate that tests whether a du type is an enum type
    to return the number of function symbols as well as the number of bits
    needed to represent them. This is the most direct differentiator between
    dummy types and enum types.

compiler/comp_unit_interface.m:
    Conform to the change in prog_type.m.

tests/valid/bug485.m:
    A regression test for the bug.

tests/valid/Mmakefile:
    Enable the new test case.
2019-09-29 12:16:30 +10:00

20 lines
499 B
Mathematica

%---------------------------------------------------------------------------%
% vim: ts=4 sw=4 et ft=mercury
%---------------------------------------------------------------------------%
:- module bug485.
:- interface.
:- type dt
---> dummy_value.
%---------------------------------------------------------------------------%
:- implementation.
:- pragma foreign_enum("C", dt/0, [
dummy_value - "42"
]).
%---------------------------------------------------------------------------%