public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/95289] New: __gnu_debug::__get_distance is not C++11 constexpr compliant
@ 2020-05-23 16:00 andysem at mail dot ru
  2020-05-23 17:11 ` [Bug libstdc++/95289] [10/11 Regression] " redi at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: andysem at mail dot ru @ 2020-05-23 16:00 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 95289
           Summary: __gnu_debug::__get_distance is not C++11 constexpr
                    compliant
           Product: gcc
           Version: 10.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: andysem at mail dot ru
  Target Milestone: ---

The following test case fails to compile in C++11 mode:

#include <vector>
#include <fstream>
#include <iterator>

void foo()
{
    typedef std::istream_iterator<char> is_iter;
    std::ifstream ifs1("test.dat");
    std::vector<char> data1;
    is_iter it1(ifs1), it_end;
    std::copy(it1, it_end, std::back_inserter(data1));
}

$ g++ -std=c++11 -D_GLIBCXX_DEBUG

/opt/compiler-explorer/gcc-10.1.0/include/c++/10.1.0/debug/helper_functions.h:108:5:
error: body of 'constexpr' function 'constexpr typename
__gnu_debug::_Distance_traits<_Iterator>::__type
__gnu_debug::__get_distance(_Iterator, _Iterator, std::input_iterator_tag)
[with _Iterator = std::istream_iterator<char>; typename
__gnu_debug::_Distance_traits<_Iterator>::__type = std::pair<long int,
__gnu_debug::_Distance_precision>]' not a return-statement

https://gcc.godbolt.org/z/6Aa1ce

This is a regression since gcc 9.

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

* [Bug libstdc++/95289] [10/11 Regression] __gnu_debug::__get_distance is not C++11 constexpr compliant
  2020-05-23 16:00 [Bug libstdc++/95289] New: __gnu_debug::__get_distance is not C++11 constexpr compliant andysem at mail dot ru
@ 2020-05-23 17:11 ` redi at gcc dot gnu.org
  2020-05-23 17:27 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: redi at gcc dot gnu.org @ 2020-05-23 17:11 UTC (permalink / raw)
  To: gcc-bugs

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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|__gnu_debug::__get_distance |[10/11 Regression]
                   |is not C++11 constexpr      |__gnu_debug::__get_distance
                   |compliant                   |is not C++11 constexpr
                   |                            |compliant
           Assignee|unassigned at gcc dot gnu.org      |redi at gcc dot gnu.org
      Known to fail|                            |10.1.0, 11.0
   Target Milestone|---                         |10.2
           Keywords|                            |rejects-valid
      Known to work|                            |9.3.0
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2020-05-23
     Ever confirmed|0                           |1

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

* [Bug libstdc++/95289] [10/11 Regression] __gnu_debug::__get_distance is not C++11 constexpr compliant
  2020-05-23 16:00 [Bug libstdc++/95289] New: __gnu_debug::__get_distance is not C++11 constexpr compliant andysem at mail dot ru
  2020-05-23 17:11 ` [Bug libstdc++/95289] [10/11 Regression] " redi at gcc dot gnu.org
@ 2020-05-23 17:27 ` cvs-commit at gcc dot gnu.org
  2020-05-23 18:13 ` cvs-commit at gcc dot gnu.org
  2020-05-23 18:14 ` redi at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-05-23 17:27 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jonathan Wakely <redi@gcc.gnu.org>:

https://gcc.gnu.org/g:3cb0c7cc160a50f830bfa9aa5a3264b773a28bf8

commit r11-589-g3cb0c7cc160a50f830bfa9aa5a3264b773a28bf8
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Sat May 23 18:27:35 2020 +0100

    libstdc++: Fix function that can't be constexpr in C++11 (PR 95289)

    The body of this function isn't just a return statement, so it can't be
    constexpr until C++14.

            PR libstdc++/95289
            * include/debug/helper_functions.h (__get_distance): Only declare
            as a constexpr function for C++14 and up.
            * testsuite/25_algorithms/copy/debug/95289.cc: New test.

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

* [Bug libstdc++/95289] [10/11 Regression] __gnu_debug::__get_distance is not C++11 constexpr compliant
  2020-05-23 16:00 [Bug libstdc++/95289] New: __gnu_debug::__get_distance is not C++11 constexpr compliant andysem at mail dot ru
  2020-05-23 17:11 ` [Bug libstdc++/95289] [10/11 Regression] " redi at gcc dot gnu.org
  2020-05-23 17:27 ` cvs-commit at gcc dot gnu.org
@ 2020-05-23 18:13 ` cvs-commit at gcc dot gnu.org
  2020-05-23 18:14 ` redi at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-05-23 18:13 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-10 branch has been updated by Jonathan Wakely
<redi@gcc.gnu.org>:

https://gcc.gnu.org/g:3ba391077d41324f6c0585f0ec76be0f44dd5b43

commit r10-8172-g3ba391077d41324f6c0585f0ec76be0f44dd5b43
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Sat May 23 18:29:33 2020 +0100

    libstdc++: Fix function that can't be constexpr in C++11 (PR 95289)

    The body of this function isn't just a return statement, so it can't be
    constexpr until C++14.

    Backport from mainline
    2020-05-23  Jonathan Wakely  <jwakely@redhat.com>

            PR libstdc++/95289
            * include/debug/helper_functions.h (__get_distance): Only declare
            as a constexpr function for C++14 and up.
            * testsuite/25_algorithms/copy/debug/95289.cc: New test.

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

* [Bug libstdc++/95289] [10/11 Regression] __gnu_debug::__get_distance is not C++11 constexpr compliant
  2020-05-23 16:00 [Bug libstdc++/95289] New: __gnu_debug::__get_distance is not C++11 constexpr compliant andysem at mail dot ru
                   ` (2 preceding siblings ...)
  2020-05-23 18:13 ` cvs-commit at gcc dot gnu.org
@ 2020-05-23 18:14 ` redi at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: redi at gcc dot gnu.org @ 2020-05-23 18:14 UTC (permalink / raw)
  To: gcc-bugs

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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED

--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Fixed for 10.2

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

end of thread, other threads:[~2020-05-23 18:14 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-23 16:00 [Bug libstdc++/95289] New: __gnu_debug::__get_distance is not C++11 constexpr compliant andysem at mail dot ru
2020-05-23 17:11 ` [Bug libstdc++/95289] [10/11 Regression] " redi at gcc dot gnu.org
2020-05-23 17:27 ` cvs-commit at gcc dot gnu.org
2020-05-23 18:13 ` cvs-commit at gcc dot gnu.org
2020-05-23 18:14 ` redi 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).