www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 13818] New: Unhelpful error message for rvalue reference:

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

          Issue ID: 13818
           Summary: Unhelpful error message for rvalue reference:
                    incompatible types for ((S()) + (S())): 'S' and 'S'
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P1
         Component: DMD
          Assignee: nobody puremagic.com
          Reporter: acehreli yahoo.com

struct S
{
    void opBinary(string op)(ref S rhs)
    {}
}

void main()
{
    auto result = S() + S();
}

Error: incompatible types for ((S()) + (S())): 'S' and 'S'

The message is bogus because S is compatible with S. ;)

--
Dec 04 2014