<html>
<head>
<base href="http://llvm.org/bugs/" />
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW --- - cinttypes does not unconditionally define format macros"
href="http://llvm.org/bugs/show_bug.cgi?id=16254">16254</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>cinttypes does not unconditionally define format macros
</td>
</tr>
<tr>
<th>Product</th>
<td>libc++
</td>
</tr>
<tr>
<th>Version</th>
<td>unspecified
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Linux
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>All Bugs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>hhinnant@apple.com
</td>
</tr>
<tr>
<th>Reporter</th>
<td>klemensbaum@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvmbugs@cs.uiuc.edu
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>test.cpp:
#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.
expected:
$ 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.
See: 27.9.2.3
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 ]</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>