On Saturday, 7 September 2019 at 22:19:48 UTC, Jonathan M Davis wrote:
On Saturday, September 7, 2019 3:40:58 PM MDT Exil via Digitalmars-d-learn wrote:
On Saturday, 7 September 2019 at 17:22:07 UTC, Jonathan M Davis

wrote:
> @safe:
> @system:
>
> then @system overrides @safe.

Just to add onto this, you can't do:

     @safe @system void foo(); // error


but you can do:

     extern(C++, ns1) extern(C++, ns2) void foo(); // ok

It makes no sense to apply multiple namespaces to the same symbol. I expect that this behavior is due to a lack of testing (the same with the out of order weirdness in the other post). It's the sort of thing that you test when you're trying to make sure that the feature does the right thing when people use it incorrectly, not the sort of thing when you're trying to make sure that the feature works as intended, so it's easy to forget.

My guess is that this behavior leaked its way in due to the fact that you need to be able to put multiple extern(C++) declarations on a symbol when you use extern(C++, struct) or extern(C++, class) in addition to the
extern(C++) for the namespace.

- Jonathan M Davis

I wonder how that undocumented and not well thought-through (or having some unobvious justifications) feature made it into a stable release.

Anyway, thank you for your help. I will probably file a bug report when I have time.





Reply via email to