[LLVMbugs] [Bug 7981] -Wformat gives erronous warning for %lc

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Oct 7 06:39:01 PDT 2010


Dan McGee <dan at archlinux.org> changed:

           What    |Removed                     |Added
             Status|RESOLVED                    |REOPENED
                 CC|                            |dan at archlinux.org
         Resolution|FIXED                       |

--- Comment #4 from Dan McGee <dan at archlinux.org> 2010-10-07 08:39:01 CDT ---
Not fixed in clang 2.8, I hope I'm not in error reopening this:

Test case:
$ cat test.c 
#include <stdio.h>
#include <wchar.h>

int main(int argc, char *argv[])
    wchar_t foo;
    foo = L't';
    printf("%lc", foo);
    printf("%lc", (wint_t)foo);

$ gcc test.c && ./a.out

$ clang test.c && ./a.out
test.c:9:12: warning: conversion specifies type 'int' but the argument has type
'wint_t' (aka 'unsigned int') [-Wformat]
        printf("%lc", (wint_t)foo);
                ~~^   ~~~~~~~~~~~
1 warning generated.

$ clang --version
clang version 2.8 (branches/release_28)
Target: x86_64-unknown-linux-gnu
Thread model: posix

This compiled without warnings in clang 2.7.

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