www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 16097] New: Confusing error message when concatenating

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 puremagic.com
          Reporter: leandro.lucarella 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)?

--
May 30 2016