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

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Aug 24 04:33:17 PDT 2010


           Summary: -Wformat gives erronous warning for %lc
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: hans at chromium.org
                CC: llvmbugs at cs.uiuc.edu, dgregor at apple.com

Compiling the following code with -Wformat generates a warning:

#include <stdio.h>

int main() {
  wchar_t wc = 'x';
  printf("%lc\n", wc);
  return 0;

clang -Wformat a.c

/tmp/a.c:5:13: warning: conversion specifies type 'long' but the argument has
type 'wchar_t' (aka 'int')
  printf("%lc\n", wc);
          ~~^     ~~
1 warning generated.

But AFAIK, the code is correct?

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