[LLVMbugs] [Bug 8781] New: -Wformat warns about using wchar_t with %d

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Dec 13 03:15:51 PST 2010


http://llvm.org/bugs/show_bug.cgi?id=8781

           Summary: -Wformat warns about using wchar_t with %d
           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


The following test program produces a warning when compiling with Clang build
from trunk (r121697):

#include <string>
#include <cstdio>

extern std::wstring s;
void f() {
  std::printf("%d\n", s[0]);
}


/tmp/a.cc:6:17: warning: conversion specifies type 'int' but the argument has
      type 'wchar_t' [-Wformat]
  std::printf("%d\n", s[0]);
               ~^     ~~~~
               %ld


Changing it to %ld doesn't help. If s is a string instead of wstring, it works
fine.

Maybe this is related to Bug 7981.

-- 
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