[LLVMbugs] [Bug 3073] New: Sema::DiagnoseAssignmentResult has broken message logic
bugzilla-daemon at cs.uiuc.edu
bugzilla-daemon at cs.uiuc.edu
Sat Nov 15 11:17:34 PST 2008
http://llvm.org/bugs/show_bug.cgi?id=3073
Summary: Sema::DiagnoseAssignmentResult has broken message logic
Product: clang
Version: unspecified
Platform: PC
OS/Version: Linux
Status: NEW
Severity: normal
Priority: P2
Component: Semantic Analyzer
AssignedTo: unassignedbugs at nondot.org
ReportedBy: sebastian.redl at getdesigned.at
CC: llvmbugs at cs.uiuc.edu
Sema::DiagnoseAssignmentResult selects an error message and then passes three
arguments to it, in this order:
1) The destination type.
2) The source type.
3) The "kind", e.g. "initializing".
However, the selected error messages aren't all compatible with this scheme.
err_typecheck_convert_incompatible, for example, was originally written to be
passed the name of the variable being initialized as the second argument and
reads thus:
"incompatible type %2 '%1', expected '%0'"
For the following code:
struct S {};
void f()
{
int i = *(S*)0;
}
this leads to the highly misleading message:
"error: incompatible type initializing 'struct S', expected 'int'"
As a user, I can only wonder why Clang thinks that I want to initialize 'struct
S'.
Unfortunately, the error message is used in other places, too, so it cannot
simply be adapted. The broken part here is, in my opinion, that
DiagnoseAssignmentResult and the call paths leading to it do not preserve the
InitEntity parameter that functions like CheckInitializerTypes have.
--
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