http://llvm.org/bugs/show_bug.cgi?id=6496
Summary: bad Clang diagnostics when signed/unsigned is combined
with a typedef
Product: clang
Version: trunk
Platform: All
OS/Version: All
Status: NEW
Severity: minor
Priority: P5
Component: C++
AssignedTo: [email protected]
ReportedBy: [email protected]
CC: [email protected], [email protected]
It's easy for a user to make the mistake of qualifying an integer typedef with
signed or unsigned. Clang's error messages aren't very helpful:
$ cat t.cc
typedef int Integer;
typedef unsigned Integer UnsignedInteger;
void Test() {
unsigned Integer foo;
unsigned bar = (unsigned Integer)-1;
}
$ clang t.cc
t.cc:2:18: error: typedef redefinition with different types ('unsigned int' vs
'int')
typedef unsigned Integer UnsignedInteger;
^
t.cc:1:13: note: previous definition is here
typedef int Integer;
^
t.cc:2:25: error: invalid token after top level declarator
typedef unsigned Integer UnsignedInteger;
^
;
t.cc:5:19: error: expected ';' at end of declaration
unsigned Integer foo;
^
;
t.cc:6:28: error: expected ')'
unsigned bar = (unsigned Integer)-1;
^
t.cc:6:18: note: to match this '('
unsigned bar = (unsigned Integer)-1;
^
6 diagnostics generated.
I'd expect to see something like "'unsigned' cannot be combined with a typedef
('Integer')."
--
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.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs