[Issue 23971] New: Provide clearer error message when trying to return a slice with C++ linkage

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Jun 5 11:31:36 UTC 2023


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

          Issue ID: 23971
           Summary: Provide clearer error message when trying to return a
                    slice with C++ linkage
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: msnmancini at hotmail.com

```d
extern(C++) const(char)[] hello()
{
    return "Hello";
}
```

I believe it would be better to get a better message such as "it is disallowed
to return D slices from C++ linkage since they have no representable mangling
in C++" or something like that.

--


More information about the Digitalmars-d-bugs mailing list