www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 21749] New: Misleading error message for an operator in an


          Issue ID: 21749
           Summary: Misleading error message for an operator in an 'alias
                    this'ed type
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: maxsamukha gmail.com

struct S {
    void opUnary(string op: "++")() {

struct S2 {
    S s;
    alias s this;

void main() {
    S2 s;

Error: s is not a scalar, it is a S2

The error should be similar to that when the operator is called explicitly:

void main() {
    S2 s;

onlineapp.d(4): Error: undefined identifier bad
onlineapp.d(15): Error: template instance onlineapp.S.opUnary!"++" error

Mar 23 2021