www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 23971] New: Provide clearer error message when trying to

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 puremagic.com
          Reporter: msnmancini 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.

--
Jun 05 2023