From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32522 invoked by alias); 25 Oct 2012 20:12:42 -0000 Received: (qmail 32440 invoked by uid 48); 25 Oct 2012 20:12:19 -0000 From: "john.salmon at deshaw dot com" 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 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: libstdc++ X-Bugzilla-Keywords: X-Bugzilla-Severity: enhancement X-Bugzilla-Who: john.salmon at deshaw dot com X-Bugzilla-Status: REOPENED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: paolo.carlini at oracle dot com X-Bugzilla-Target-Milestone: 4.7.0 X-Bugzilla-Changed-Fields: Status Resolution Message-ID: In-Reply-To: References: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2012-10/txt/msg02374.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40856 John Salmon changed: What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |REOPENED Resolution|FIXED | --- Comment #12 from John Salmon 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 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 #include #include 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$