[Issue 16097] New: Confusing error message when concatenating const(char)*

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Mon May 30 06:29:23 PDT 2016


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

          Issue ID: 16097
           Summary: Confusing error message when concatenating
                    const(char)*
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: minor
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: leandro.lucarella at sociomantic.com

This might happen with other variations of char* I guess:

---
void f()
{
    const(char)* s = "some literal";
    auto ss = "hello" ~ s;
}
---


Output:
---
/tmp/s.d(6): Error: incompatible types for (("hello") ~ (s)): 'const(char)*'
and 'const(char)*'
---

It might be helpful to mention there is no operator `~` defined for these two
types, and maybe even suggest a way to do it (convert to something else using
some std function)?

--


More information about the Digitalmars-d-bugs mailing list