Currently when you import std.c.windows.windows on a non-Windows machine, the file and line number of std/c/windows/windows.d is returned due to a static assert(0). This is great and all, but it would be really nice to have the file and line number of the importer. I don't know of how to improve this. Maybe an improvement to DMD so that a module that is imported and has a static assert(0) results in the importer file and line being used?
More generally, it may useful to have an error message for failed imports that shows the file name and line number of the module that contains the import statement.
you might want to try dmd -v. It shows imports in the order they were imported. It doesn't show the file which imports it, but you can get a good idea probably from the prior file list. I'd say adding the file imported from would be a good thing to add to -v.
Created attachment 812 [details] PATCH against rev 755: implement a module import backtrace for static assert Implements a module import back-trace for static asserts. This ought to be implemented for non-static asserts as well, but that probably involves mucking about in the back end and I can't be bothered diving into that at the mo.
Created attachment 816 [details] PATCH against rev 755: implement a module import backtrace for static assert modified patch so it doesn't print module back trace when inside a template, the template instantiation trace already gets printed.
Created attachment 818 [details] PATCH against rev 755: implement a module import backtrace for static assert ...and printing the correct import location might help
This program compiles fine on Ubuntu right now: --- import std.c.windows.windows; --- Was fixed years ago when we introduced top-level version per platform in each file.