[llvm-bugs] [Bug 26722] New: Requesting an additional diagnostic note on invalid casts
    via llvm-bugs 
    llvm-bugs at lists.llvm.org
       
    Tue Feb 23 18:01:27 PST 2016
    
    
  
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: unassignedclangbugs at nondot.org
          Reporter: Yunzhong_Gao at playstation.sony.com
                CC: llvm-bugs at 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20160224/b2726f80/attachment.html>
    
    
More information about the llvm-bugs
mailing list