Skip to content

Major blocker: DMD bogus forward and circular reference errors. #105

@Syniurge

Description

@Syniurge

Right now the (last?) major blocker for many complex C++ libraries lies in incorrect forward and circular referencing errors, caused by how DMD's semantic phases are currently designed. Those phases are too "catchall" and for example calling dsym.semantic() when all the caller wants to know is if the dsym symbol has a member named "foo" creates dependencies between symbols that may result in wrong forward/circular referencing errors.

The qt5demo example just got updated to not rely on module map files (which will be replaced by a pragma(cppmap) parameter like proposed in https://github.com/Syniurge/Calypso/blob/documentation/calypso_proposal_pragma.md), but doesn't compile anymore because it triggers a circular referencing error within a Qt module.

I will fix a few more Calypso-specific issues, and then will start working on this again. I had a first shot at this last year: dlang/dmd#7018 but will soon restart from scratch from current DMD master.

It will consist in splitting importAll/semanticN functions into smaller blocks, and making DMD semantic analysis lazier especially for non-root modules (the ones not being codegen'd). The latter will also help against another Calypso issue which is the recursive instantiation of templates due to C++ being completely lazy whereas D isn't. For example the libstdc++/valarray.d test case fails because of recursive instantiation. Others would if there wasn't a RecursiveInstChecker semi-hack that detects simple cases of recursive recursions and discard the declarations, but discarding is pretty bad.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions