https://llvm.org/bugs/show_bug.cgi?id=26722

            Bug ID: 26722
           Summary: Requesting an additional diagnostic note on invalid
                    casts
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: Frontend
          Assignee: unassignedclangb...@nondot.org
          Reporter: yunzhong_...@playstation.sony.com
                CC: llvm-bugs@lists.llvm.org
    Classification: Unclassified

I have the following two test cases.

//------ test1.cc
class base {
    virtual void func() { }
};

class Derived;

void test(Derived *x) {
    base *y = x; // error here about invalid cast
}
//------ end test1.cc


//------ test2.cc
class base {
    virtual void func() { }
};

class Derived { };

void test(Derived *x) {
    base *y = x; // error here about invalid cast
}
//------ end test2.cc

When I compile with clang, I get the same error for both test cases:
error: cannot initialize a variable of type 'base *' with an lvalue of type
'Derived *'


This is a feature request for an additional note that differentiates the
two test cases. For example, maybe

for the first test case,
note: class type 'Derived' is incomplete

And for the second test case,
note: class type 'Derived' is not inheriting from class type 'base'


If I try the same test case on the online compiler at ideone.com, I would
get the note as I described for the first test case.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to