Skip to content

Odd codegen bug with adrdox #5130

@0xEAB

Description

@0xEAB

When one builds adrdox with LDC, the resulting executable fails with an odd exception.

Details

First pass processing /home/mindy/ldc-issue-5130/foo.d
object.Exception@doc2.d(4407): you must have a module declaration for this to work on it

Building adrdox with DMD, however, produces a working executable.

Reproducer

set +e

# Please verify whether `dmd` isn’t `ldmd2`!
ls -l $(which dmd)
readlink $(which dmd)

# Create test directory.
mkdir ldc-issue-5130
cd ldc-issue-5130

# Download a version before the LDC-disablement patch.
curl -fLSo \
	adrdox.tar.gz \
	https://github.com/adamdruppe/adrdox/archive/9915e53ee6656b38167bfc4d12ef8710dd3654f2.tar.gz

mkdir adrdox-src
tar \
	xf adrdox.tar.gz \
	-C adrdox-src \
	--strip-components=1

# Drop sample code.
echo '/++ Lorem ipsum +/ module foo;' > foo.d

# adrdox built with DMD works.
echo -e "\n== DMD ==\n"
DMD=dmd make -C adrdox-src
./adrdox-src/doc2 foo.d

# adrdox built with LDC bugs out.
echo -e "\n== LDC ==\n"
DMD=ldmd2 make -C adrdox-src
./adrdox-src/doc2 foo.d

Additional context

@adamdruppe wrote on Discord:
if ldc.......... don't. there's some codegen bug that affects this
i have never been able to track it down. i should prolly put in a static assert

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions