public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/96042] New: Reference type of std::ranges::iota is __int128 with -std=c++2a?!
@ 2020-07-02 22:53 gcc-bugs at marehr dot dialup.fu-berlin.de
  2020-07-03 11:03 ` [Bug libstdc++/96042] " redi at gcc dot gnu.org
                   ` (11 more replies)
  0 siblings, 12 replies; 13+ messages in thread
From: gcc-bugs at marehr dot dialup.fu-berlin.de @ 2020-07-02 22:53 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96042

            Bug ID: 96042
           Summary: Reference type of std::ranges::iota is __int128 with
                    -std=c++2a?!
           Product: gcc
           Version: 10.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: gcc-bugs at marehr dot dialup.fu-berlin.de
  Target Milestone: ---

The following code

```c++
#include <ranges>

using iota_view = std::ranges::iota_view<size_t>;
using reference_t = std::ranges::range_difference_t<iota_view>;

static_assert(std::same_as<reference_t, __int128>); // why?

// but std::numeric_limits is not specialised which indicates that we use
__STRICT_ANSI__

using t = std::numeric_limits<__int128>;
static_assert(t::is_specialized);
```

https://godbolt.org/z/-XFyYN

I don't fully understand what `__int128` and `__STRICT_ANSI__` means, but I
think it is unexpected that I get a type that is not described in the standard.

I know that `std::indirectly_readable` allows (compiler) implementation defined
signed integer types, but from what I have seen, `__int128` is normally only
supported / exposed in the gnu standard library if `__STRICT_ANSI__` is not
defined.

Since `-std=c++2a` does not provide a specialisation for `std::numeric_limits`,
I assume that this means, that `__STRICT_ANSI__` is not defined in that mode,
and I think this is inconsistent behaviour.

Related issues in the range-v3 library:
* https://github.com/ericniebler/range-v3/issues/1514
* https://github.com/ericniebler/range-v3/issues/1516

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2020-11-13 13:11 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-02 22:53 [Bug libstdc++/96042] New: Reference type of std::ranges::iota is __int128 with -std=c++2a?! gcc-bugs at marehr dot dialup.fu-berlin.de
2020-07-03 11:03 ` [Bug libstdc++/96042] " redi at gcc dot gnu.org
2020-07-03 12:47 ` gcc-bugs at marehr dot dialup.fu-berlin.de
2020-07-06 11:35 ` redi at gcc dot gnu.org
2020-07-07  1:07 ` rs2740 at gmail dot com
2020-07-07 12:20 ` redi at gcc dot gnu.org
2020-08-19 15:38 ` redi at gcc dot gnu.org
2020-08-19 15:59 ` cvs-commit at gcc dot gnu.org
2020-08-19 19:36 ` cvs-commit at gcc dot gnu.org
2020-11-12 14:09 ` cvs-commit at gcc dot gnu.org
2020-11-12 14:34 ` cvs-commit at gcc dot gnu.org
2020-11-12 14:35 ` redi at gcc dot gnu.org
2020-11-13 13:11 ` cvs-commit at gcc dot gnu.org

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).