[LLVMbugs] [Bug 7990] New: calling non-const method from a const method produces embarrassing diagnostic
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Wed Aug 25 11:31:00 PDT 2010
http://llvm.org/bugs/show_bug.cgi?id=7990
Summary: calling non-const method from a const method produces
embarrassing diagnostic
Product: clang
Version: unspecified
Platform: PC
OS/Version: All
Status: NEW
Severity: normal
Priority: P
Component: C++
AssignedTo: unassignedclangbugs at nondot.org
ReportedBy: clattner at apple.com
CC: llvmbugs at cs.uiuc.edu, dgregor at apple.com
I got this today:
/Volumes/Projects/cvs/llvm/include/llvm/Target/TargetLowering.h:227:14: error:
cannot initialize
object parameter of type 'llvm::TargetLowering::ValueTypeActionImpl' with
an expression of
type 'llvm::TargetLowering::ValueTypeActionImpl const'
As is super obvious from the message, the caller is marked const, but the
callee is not. wtf.
Here's a testcase:
struct foo {
void bar();
void bonk() const {
bar();
}
};
GCC produces:
t.cc: In member function ‘void foo::bonk() const’:
t.cc:6: error: passing ‘const foo’ as ‘this’ argument of ‘void foo::bar()’
discards qualifiers
which is better, but it would even be better to special case this and produce a
really amazing diagnostic for this common error.
--
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
More information about the llvm-bugs
mailing list