Skip to content

Conversation

@Emmankoko
Copy link
Contributor

I am opening this PR to reinvent the wheel for C complex for importC.
reading few comments in DMD, and conversations with @ibuclaw , DMD has the intentions of using the D fundamental complex types which is ABI compatible with the C complex types. but the implementations in several parts of the compiler contradict that. that's the main cause of issues opened on C complex and will make it impossible to compile third party libraries. with the issues opened on complex, we could provide fixes to make them work but in the end, they would be fragile since the main internal C complex machinery is broken in DMD.

This PR is supposed to lead to C complex no longer interpreted as _Complex!T.

@dlang-bot
Copy link
Contributor

dlang-bot commented Dec 14, 2025

Thanks for your pull request and interest in making D better, @Emmankoko! We are looking forward to reviewing it, and you should be hearing from a maintainer soon.
Please verify that your PR follows this checklist:

  • My PR is fully covered with tests (you can see the coverage diff by visiting the details link of the codecov check)
  • My PR is as minimal as possible (smaller, focused PRs are easier to review than big ones)
  • I have provided a detailed rationale explaining my changes
  • New or modified functions have Ddoc comments (with Params: and Returns:)

Please see CONTRIBUTING.md for more information.


If you have addressed all reviews or aren't sure how to proceed, don't hesitate to ping us with a simple comment.

Bugzilla references

Your PR doesn't reference any Bugzilla issue.

If your PR contains non-trivial changes, please reference a Bugzilla issue or create a manual changelog.

⚠️⚠️⚠️ Warnings ⚠️⚠️⚠️

  • In preparation for migrating from Bugzilla to GitHub Issues, the issue reference syntax has changed. Please add the word "Bugzilla" to issue references. For example, Fix Bugzilla Issue 12345 or Fix Bugzilla 12345.(Reminder: the edit needs to be done in the Git commit message, not the GitHub pull request.)

Testing this PR locally

If you don't have a local development environment setup, you can use Digger to test this PR:

dub run digger -- build "master + dmd#22238"

@dkorpel
Copy link
Contributor

dkorpel commented Dec 14, 2025

Complex numbers as a fundamental type are deprecated, lowering to a library struct is the way forward.

@Herringway
Copy link
Contributor

Complex numbers as a fundamental type are deprecated, lowering to a library struct is the way forward.

The "way forward" is the status quo, and it appears to be broken.

#22218 (comment)

@Emmankoko
Copy link
Contributor Author

an example comment I found in typesem, it has excluded C code in fundamental complex duplication.

https://github.com/dlang/dmd/blob/master/compiler/src/dmd/typesem.d#L1433

since c_long_double is a (1o bytes) known mismatch, complex real similarly falls
in that category since it is simple two long doubles
@Emmankoko Emmankoko force-pushed the complex branch 2 times, most recently from cab4f9b to 9adad75 Compare December 18, 2025 12:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants