[Issue 20012] export inside mixin doesn't seem to work

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Jul 24 01:20:04 UTC 2019


https://issues.dlang.org/show_bug.cgi?id=20012

--- Comment #3 from Walter Bright <bugzilla at digitalmars.com> ---
Is it? Note the same behavior happens with:

  struct S { extern (C) void foo() { } }

i.e. foo() gets mangled. There are two aspects of C mangling - one is the ABI,
the other is the ABI. Using C mangling in a scope means there can be only one,
so D just uses it to set the ABI.

But there's another way you can do it:

  mixin template M()
  {
    export extern(C) pragma(mangle, "fun") void fun() {}
  }
  mixin M!();

which will work.

--


More information about the Digitalmars-d-bugs mailing list