<html>
<head>
<base href="https://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 --- - std::is_integral<__int128>::value is false with libstdc++ from GCC 5."
href="https://llvm.org/bugs/show_bug.cgi?id=23156">23156</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>std::is_integral<__int128>::value is false with libstdc++ from GCC 5.
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</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>C++
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>toojays@toojays.net
</td>
</tr>
<tr>
<th>CC</th>
<td>dgregor@apple.com, llvmbugs@cs.uiuc.edu
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>g++-5 (Ubuntu 5-20150329-1ubuntu11~14.04) 5.0.0 20150329 (experimental) [trunk
revision 221764]
Ubuntu clang version 3.6.1-svn232753-1~exp1 (branches/release_36) (based on
LLVM 3.6.1)
jscott@citra:/tmp$ cat int128.cpp
#include <type_traits>
int main ()
{
static_assert(std::is_integral<__int128>::value, "__int128 should be
integral");
return 0;
}
jscott@citra:/tmp$ g++-5 -std=gnu++11 -c int128.cpp
jscott@citra:/tmp$ clang++ -std=gnu++11 -c int128.cpp
int128.cpp:5:3: error: static_assert failed "__int128 should be integral"
static_assert(std::is_integral<__int128>::value, "__int128 should be
integral");
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
With GCC 4.9, this program builds fine.
This breakage appears to be due to the following GCC change:
<a href="http://permalink.gmane.org/gmane.comp.gcc.cvs/165545">http://permalink.gmane.org/gmane.comp.gcc.cvs/165545</a>
In GCC 4.9 there was a symbol _GLIBCXX_USE_INT128 defined somewhere (maybe in
some config header? I'm not sure) which let this work. With GCC 5,
__GLIBCXX_TYPE_INT_N_0 and __GLIBCXX_BITSIZE_INT_N_0 are built into the
preprocessor, and must be defined to let type_traits acknowledge __int128 as an
integer.
I discovered this issue due to some code which uses GCC's SIMD Mersenne Twister
extension. A minimal example is:
#include <ext/random>
typedef __gnu_cxx::simd_fast_mersenne_twister_engine<
unsigned __int128,
/* The following parameters all relate to Mersenne Twister internal
* state. These are thoughtlessly copied from the definition of sfmt19937.
*/
19937, 122,
18, 1, 11, 1,
0xdfffffefU, 0xddfecb7fU,
0xbffaffffU, 0xbffffff6U,
0x00000001U, 0x00000000U,
0x00000000U, 0x13c9e684U>
sfmt19937_128;
int main ()
{
sfmt19937_128 engine;
auto value = engine();
}
Which fails to build with Clang 3.6 + libstdc++ 5.0 like:
jscott@citra:/tmp$ clang++ -std=gnu++11 random.cpp
In file included from random.cpp:1:
/usr/bin/../lib/gcc/x86_64-linux-gnu/5.0.0/../../../../include/c++/5.0.0/ext/random:67:7:
error: static_assert failed "template argument substituting _UIntType not an
unsigned integral type"
static_assert(std::is_unsigned<_UIntType>::value, "template argument "
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
random.cpp:18:17: note: in instantiation of template class
'__gnu_cxx::simd_fast_mersenne_twister_engine<unsigned __int128, 19937, 122,
18, 1, 11, 1, 3758096367, 3724462975, 3220897791, 3221225462, 1, 0, 0,
331998852>' requested here
sfmt19937_128 engine;
^
1 error generated.
With the following definitions added to the top of the file it builds. Haven't
tried a real example to see if it works though.
"""
#define __GLIBCXX_BITSIZE_INT_N_0 128
#define __GLIBCXX_TYPE_INT_N_0 __int128
"""</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>