This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libstdc++/40856] numeric_limits not specialized for __int128_t or __uint128_t
- From: "john.salmon at deshaw dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 25 Oct 2012 20:12:14 +0000
- Subject: [Bug libstdc++/40856] numeric_limits not specialized for __int128_t or __uint128_t
- Auto-submitted: auto-generated
- References: <bug-40856-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40856
John Salmon <john.salmon at deshaw dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|RESOLVED |REOPENED
Resolution|FIXED |
--- Comment #12 from John Salmon <john.salmon at deshaw dot com> 2012-10-25 20:12:14 UTC ---
Somewhere along the way, the specializations for this bug and for some
related type_traits (make_signed, make_unsigned, is_integral) were
conditionalized with:
#if !defined(__STRICT_ANSI__) && defined(_GLIBCXX_USE_INT128)
I think the STRICT_ANSI condition is a mistake. It has always been
the case that the availability of the __[u]int128_t types has been
independent of the value of __STRICT_ANSI__. Similarly, the
specializations of numeric_limits and type_traits should be present
regardless of whether __STRICT_ANSI__ is in effect.
The check for defined(_GLIBXX_USE_INT128) should be both necessary and
sufficient.
If I can declare a variable of a non-standard extension-type with some
compiler flags in effect, e.g., -std=c++11, then I should also be able
to get a sensible answer from std::numeric_limits and <type_traits>
with the same compiler flags.
This code should produce the same results with -std=g++11 and -std=c++11:
drdlogin0039$ cat strict128.cpp
#include <type_traits>
#include <limits>
#include <iostream>
int main(int , char **){
__int128_t i;
std::cout << "is_specialized: " <<
std::numeric_limits<__int128_t>::is_specialized << "\n";
std::cout << "is_integral: " << std::is_integral<__int128_t>::value <<
"\n";
return 0;
}
drdlogin0039$ g++ -std=gnu++11 strict128.cpp && ./a.out
is_specialized: 1
is_integral: 1
drdlogin0039$ g++ -std=c++11 strict128.cpp && ./a.out
is_specialized: 0
is_integral: 0
drdlogin0039$