http://llvm.org/bugs/show_bug.cgi?id=6030
Summary: confusing warning from clang re. incompatible pointer
types
Product: new-bugs
Version: trunk
Platform: PC
OS/Version: Linux
Status: NEW
Severity: normal
Priority: P2
Component: new bugs
AssignedTo: [email protected]
ReportedBy: [email protected]
CC: [email protected]
The second warning effectively says "X is wrong, expected X". Obviously the
code is bogus but the warning could be better!
reg...@john-home:~/volatile/bugs/tmp256$ clang small.c -c
small.c:5:25: warning: declaration of 'struct archive_read' will not be visible
outside of this function
int (*finish) (struct archive_read *);
^
small.c:18:29: warning: incompatible pointer types assigning 'int (*)(struct
archive_read *)', expected 'int (*)(struct archive_read *)'
(a->decompressor)->finish = &archive_decompressor_none_finish;
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2 diagnostics generated.
reg...@john-home:~/volatile/bugs/tmp256$ cat small.c
typedef unsigned long size_t;
struct decompressor_t
{
int (*finish) (struct archive_read *);
};
struct archive_read
{
struct decompressor_t *decompressor;
};
int archive_decompressor_none_finish (struct archive_read *a);
int archive_decompressor_none_init (struct archive_read *a, void const *buff,
size_t n)
{
(a->decompressor)->finish = &archive_decompressor_none_finish;
return 0;
}
reg...@john-home:~/volatile/bugs/tmp256$ clang -v
clang version 1.1 (trunk 93238)
Target: i386-pc-linux-gnu
Thread model: posix
--
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