[LLVMbugs] [Bug 16254] New: cinttypes does not unconditionally define format macros

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Jun 6 21:24:40 PDT 2013


            Bug ID: 16254
           Summary: cinttypes does not unconditionally define format
           Product: libc++
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: All Bugs
          Assignee: hhinnant at apple.com
          Reporter: klemensbaum at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

#include <cinttypes>
#include <cstdint>
#include <cstdio>
int main() {
        std::uint64_t test = 42;
        std::printf("%" PRIu64, test);
        return 0;

 clang++ -std=c++11 test.cpp -stdlib=libc++
test.cpp:7:18: error: expected ')'
        std::printf("%" PRIu64, test);
test.cpp:7:13: note: to match this '('
        std::printf("%" PRIu64, test);
1 error generated.

$ clang++ -std=c++11 test.cpp
$ g++ -std=c++11 test.cpp

This is because <inttypes.h> requires __STDC_FORMAT_MACROS to define the macros
for C++ but <cinttypes> doesn't define it.

Table 135 describes header <cinttypes>. [ Note: The macros defined by
<cinttypes> are provided unconditionally. In particular, the symbol
__STDC_FORMAT_MACROS, mentioned in footnote 182 of the C standard, plays no
role in C ++. — end note ]

You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20130607/f975ea38/attachment.html>

More information about the llvm-bugs mailing list