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

             Bug #: 12838
           Summary: Suggest "%zu" for sizeof expressions in printf calls
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Frontend
        AssignedTo: [email protected]
        ReportedBy: [email protected]
                CC: [email protected]
    Classification: Unclassified


% clang -fsyntax-only -Wformat -std=c++11 test.cc
test.cc:5:12: warning: format specifies type 'unsigned int' but the argument
has type 'unsigned long' [-Wformat]
  printf("%u\n", sizeof(i));
          ~^     ~~~~~~~~~
          %lu

The standard says that the argument has type size_t, but we apparently think
it's just a long when we're checking the format string.

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

Reply via email to