www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 21373] New: extern(C++) ignored on template mixin declarations

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

          Issue ID: 21373
           Summary: extern(C++) ignored on template mixin declarations
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: moonlightsentinel disroot.org

Test case:
========================================

extern(C++)
mixin template MTC()
{
    int foo(int i)
    {
        return i;
    }
}

mixin MTC!();

static assert(__traits(getLinkage, foo) == "C++");

========================================

The assert currently fails because the `extern(C++)` has no effect on foo,
causing __traits(getLinkage, foo) to return "D".

--
Nov 09 2020