public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "john.salmon at deshaw dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug libstdc++/40856] numeric_limits not specialized for __int128_t or __uint128_t
Date: Thu, 25 Oct 2012 20:12:00 -0000	[thread overview]
Message-ID: <bug-40856-4-9Dx95DB1n1@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <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$


  parent reply	other threads:[~2012-10-25 20:12 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <bug-40856-4@http.gcc.gnu.org/bugzilla/>
2011-09-19 11:43 ` paolo.carlini at oracle dot com
2011-09-19 12:17 ` paolo at gcc dot gnu.org
2011-09-19 12:21 ` paolo.carlini at oracle dot com
2012-10-22 12:21 ` zerotype at yahoo dot com
2012-10-22 12:42 ` jakub at gcc dot gnu.org
2012-10-25 20:12 ` john.salmon at deshaw dot com [this message]
2012-10-25 20:24 ` glisse at gcc dot gnu.org
2012-10-25 20:28 ` paolo.carlini at oracle dot com
2012-10-25 21:36 ` paolo.carlini at oracle dot com
2012-10-25 21:40 ` paolo.carlini at oracle dot com
2012-12-07  9:20 ` rguenth at gcc dot gnu.org
2012-12-07 10:20 ` paolo.carlini at oracle dot com
2009-07-25 15:02 [Bug libstdc++/40856] New: " john dot salmon at deshaw dot com
2009-07-26  9:26 ` [Bug libstdc++/40856] " paolo dot carlini at oracle dot com
2009-12-17 12:09 ` paolo dot carlini at oracle dot com
2009-12-17 12:10 ` paolo dot carlini at oracle dot com
2010-02-18 14:10 ` paolo dot carlini at oracle dot com
2010-02-18 14:11 ` paolo dot carlini at oracle dot com
2010-05-25 20:57 ` paolo dot carlini at oracle dot com
2010-05-25 21:04 ` paolo dot carlini at oracle dot com

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-40856-4-9Dx95DB1n1@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).