public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/65942] New: cannot use std::function as comparator in algorithms
@ 2015-04-30  9:03 avi@cloudius-systems.com
  2015-04-30  9:14 ` [Bug libstdc++/65942] [5/6 Regression] [C++14] " redi at gcc dot gnu.org
                   ` (12 more replies)
  0 siblings, 13 replies; 14+ messages in thread
From: avi@cloudius-systems.com @ 2015-04-30  9:03 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 65942
           Summary: cannot use std::function as comparator in algorithms
           Product: gcc
           Version: 5.0
            Status: UNCONFIRMED
          Severity: critical
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: avi@cloudius-systems.com
  Target Milestone: ---

Too much template magic causes gcc 5.1 to reject the following valid code:



#include <experimental/optional>
#include <algorithm>
#include <functional>

using T1 = int;
using T2 = std::vector<T1>;

bool cmp1(const T1& a, const T1& b) { return a < b; }
std::function<bool (const T1&, const T1&)> cmp2 = cmp1;

int main(int ac, char** av) {
  T2 v;
  std::sort(v.begin(), v.end(), cmp1); // works
  std::sort(v.begin(), v.end(), cmp2); // fails
}

Even though the two calls to sort() should be identical, the second one does
not compile.

This is a regression from 4.9


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

* [Bug libstdc++/65942] [5/6 Regression] [C++14] cannot use std::function as comparator in algorithms
  2015-04-30  9:03 [Bug libstdc++/65942] New: cannot use std::function as comparator in algorithms avi@cloudius-systems.com
@ 2015-04-30  9:14 ` redi at gcc dot gnu.org
  2015-04-30  9:22 ` redi at gcc dot gnu.org
                   ` (11 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: redi at gcc dot gnu.org @ 2015-04-30  9:14 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |rejects-valid
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2015-04-30
            Summary|cannot use std::function as |[5/6 Regression] [C++14]
                   |comparator in algorithms    |cannot use std::function as
                   |                            |comparator in algorithms
     Ever confirmed|0                           |1
           Severity|critical                    |normal

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
The <experimental/optional> header is not relevant to the bug.

The error only happens in C++14 mode.

#include <algorithm>
#include <functional>

bool cmp1(const int& a, const int& b) { return a < b; }
std::function<bool (const int&, const int&)> cmp2 = cmp1;

int main() {
  int v[1];
  std::sort(v, v, cmp1); // works
  std::sort(v, v, cmp2); // fails
}


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

* [Bug libstdc++/65942] [5/6 Regression] [C++14] cannot use std::function as comparator in algorithms
  2015-04-30  9:03 [Bug libstdc++/65942] New: cannot use std::function as comparator in algorithms avi@cloudius-systems.com
  2015-04-30  9:14 ` [Bug libstdc++/65942] [5/6 Regression] [C++14] " redi at gcc dot gnu.org
@ 2015-04-30  9:22 ` redi at gcc dot gnu.org
  2015-04-30  9:32 ` [Bug c++/65942] " redi at gcc dot gnu.org
                   ` (10 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: redi at gcc dot gnu.org @ 2015-04-30  9:22 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
It's due to the addition of C++14 constexpr throughout the library, the program
works if preceded by 

#include <bits/c++config.h>
#undef _GLIBCXX14_CONSTEXPR
#define _GLIBCXX14_CONSTEXPR

so that the newly-constexpr functions are not constexpr.


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

* [Bug c++/65942] [5/6 Regression] [C++14] cannot use std::function as comparator in algorithms
  2015-04-30  9:03 [Bug libstdc++/65942] New: cannot use std::function as comparator in algorithms avi@cloudius-systems.com
  2015-04-30  9:14 ` [Bug libstdc++/65942] [5/6 Regression] [C++14] " redi at gcc dot gnu.org
  2015-04-30  9:22 ` redi at gcc dot gnu.org
@ 2015-04-30  9:32 ` redi at gcc dot gnu.org
  2015-04-30  9:46 ` trippels at gcc dot gnu.org
                   ` (9 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: redi at gcc dot gnu.org @ 2015-04-30  9:32 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|libstdc++                   |c++

--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> ---
This seems to be a compiler bug not a library bug:

#include <functional>

bool cmp1(const int& a, const int& b) { return a < b; }
std::function<bool (const int&, const int&)> cmp2 = cmp1;

  template<typename _Compare>
    struct _Iter_comp_iter
    {
      _Compare _M_comp;
      _Iter_comp_iter(_Compare __comp)
        : _M_comp(__comp)
      { }

      template<typename _Iterator1, typename _Iterator2>
#if __cplusplus >= 201402L
        constexpr
#endif
        bool
        operator()(_Iterator1 __it1, _Iterator2 __it2)
        { return bool(_M_comp(*__it1, *__it2)); }
    };

  template<typename _Compare>
    inline _Iter_comp_iter<_Compare>
    __iter_comp_iter(_Compare __comp)
    { return _Iter_comp_iter<_Compare>(__comp); }

int main() {
  int v[1];
  int* iter = v;
  auto cmp = __iter_comp_iter(cmp2);
  cmp(iter, iter);
}


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

* [Bug c++/65942] [5/6 Regression] [C++14] cannot use std::function as comparator in algorithms
  2015-04-30  9:03 [Bug libstdc++/65942] New: cannot use std::function as comparator in algorithms avi@cloudius-systems.com
                   ` (2 preceding siblings ...)
  2015-04-30  9:32 ` [Bug c++/65942] " redi at gcc dot gnu.org
@ 2015-04-30  9:46 ` trippels at gcc dot gnu.org
  2015-04-30 10:03 ` avi@cloudius-systems.com
                   ` (8 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: trippels at gcc dot gnu.org @ 2015-04-30  9:46 UTC (permalink / raw)
  To: gcc-bugs

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

Markus Trippelsdorf <trippels at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |trippels at gcc dot gnu.org

--- Comment #4 from Markus Trippelsdorf <trippels at gcc dot gnu.org> ---
Well, clang rejects your testcase, too.

test2.cpp:20:31: error: indirection requires pointer operand ('int' invalid)
        { return bool(_M_comp(*__it1, *__it2)); }
                              ^~~~~~
/usr/lib64/gcc/x86_64-pc-linux-gnu/5.1.1/include/g++-v5/functional:1981:27:
note: in instantiation of function template specialization
'_Iter_comp_iter<std::function<bool
      (const int &, const int &)> >::operator()<int, int>' requested here
        using _Invoke = decltype(__callable_functor(std::declval<_Functor&>())
                                 ^
/usr/lib64/gcc/x86_64-pc-linux-gnu/5.1.1/include/g++-v5/functional:1990:2:
note: in instantiation of template type alias '_Invoke' requested here
        using _Callable
        ^
/usr/lib64/gcc/x86_64-pc-linux-gnu/5.1.1/include/g++-v5/functional:2057:30:
note: in instantiation of template type alias '_Callable' requested here
               typename = _Requires<_Callable<_Functor>, void>>
                                    ^
/usr/lib64/gcc/x86_64-pc-linux-gnu/5.1.1/include/g++-v5/functional:2058:2:
note: in instantiation of default argument for
'function<_Iter_comp_iter<std::function<bool
      (const int &, const int &)> > >' required here
        function(_Functor);
        ^~~~~~~~
test2.cpp:31:14: note: while substituting deduced template arguments into
function template 'function' [with _Functor =
_Iter_comp_iter<std::function<bool
      (const int &, const int &)> >, $1 = (no value)]
  auto cmp = __iter_comp_iter(cmp2);
             ^
1 error generated.


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

* [Bug c++/65942] [5/6 Regression] [C++14] cannot use std::function as comparator in algorithms
  2015-04-30  9:03 [Bug libstdc++/65942] New: cannot use std::function as comparator in algorithms avi@cloudius-systems.com
                   ` (3 preceding siblings ...)
  2015-04-30  9:46 ` trippels at gcc dot gnu.org
@ 2015-04-30 10:03 ` avi@cloudius-systems.com
  2015-04-30 10:05 ` trippels at gcc dot gnu.org
                   ` (7 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: avi@cloudius-systems.com @ 2015-04-30 10:03 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Avi Kivity <avi@cloudius-systems.com> ---
That's clang + libstdc++-5.1, so if the problem is in libstdc++, it's the same
bug.


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

* [Bug c++/65942] [5/6 Regression] [C++14] cannot use std::function as comparator in algorithms
  2015-04-30  9:03 [Bug libstdc++/65942] New: cannot use std::function as comparator in algorithms avi@cloudius-systems.com
                   ` (4 preceding siblings ...)
  2015-04-30 10:03 ` avi@cloudius-systems.com
@ 2015-04-30 10:05 ` trippels at gcc dot gnu.org
  2015-04-30 10:06 ` redi at gcc dot gnu.org
                   ` (6 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: trippels at gcc dot gnu.org @ 2015-04-30 10:05 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from Markus Trippelsdorf <trippels at gcc dot gnu.org> ---
(In reply to Avi Kivity from comment #5)
> That's clang + libstdc++-5.1, so if the problem is in libstdc++, it's the
> same bug.

Yes. clang++ -stdlib=libc++ -std=gnu++14 original_testcase.cpp 
is also fine.


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

* [Bug c++/65942] [5/6 Regression] [C++14] cannot use std::function as comparator in algorithms
  2015-04-30  9:03 [Bug libstdc++/65942] New: cannot use std::function as comparator in algorithms avi@cloudius-systems.com
                   ` (5 preceding siblings ...)
  2015-04-30 10:05 ` trippels at gcc dot gnu.org
@ 2015-04-30 10:06 ` redi at gcc dot gnu.org
  2015-04-30 10:22 ` [Bug libstdc++/65942] " redi at gcc dot gnu.org
                   ` (5 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: redi at gcc dot gnu.org @ 2015-04-30 10:06 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Yes, and so do 4.8 and 4.9 for this reduced form with no library dependencies.
This fails with -std=c++11 but compiles OK with -std=c++11 -DOK.

EDG accepts it without -DOK


template<typename _Tp>
  _Tp&& declval() noexcept;

template<typename> struct function;

template<typename _Res, typename... _ArgTypes>
  struct function<_Res(_ArgTypes...)>
  {
    template<typename _Functor,
             typename = decltype( declval<_Functor&>()(declval<_ArgTypes>()...)
)>
      function(_Functor) { }

    function() { }

    _Res operator()(_ArgTypes...) const;
  };


  template<typename _Compare>
    struct _Iter_comp_iter
    {
      _Compare _M_comp;

      _Iter_comp_iter(_Compare __comp)
        : _M_comp(__comp)
      { }

      template<typename _Iterator1, typename _Iterator2>
#ifndef OK
        constexpr
#endif
        bool
        operator()(_Iterator1 __it1, _Iterator2 __it2)
        { return bool(_M_comp(*__it1, *__it2)); }
    };

using F = function<bool (int, int)>;
F f;
_Iter_comp_iter<F> c{ f };
auto c2 = c;



f.cc: In instantiation of ‘constexpr bool
_Iter_comp_iter<_Compare>::operator()(_Iterator1, _Iterator2) const [with
_Iterator1 = int; _Iterator2 = int; _Compare = function<bool(int, int)>]’:
f.cc:10:54:   required by substitution of ‘template<class _Functor, class>
function<_Res(_ArgTypes ...)>::function(_Functor) [with _Functor =
_Iter_comp_iter<function<bool(int, int)> >; <template-parameter-1-2> =
<missing>]’
f.cc:40:11:   required from here
f.cc:34:31: error: invalid type argument of unary ‘*’ (have ‘int’)
         { return bool(_M_comp(*__it1, *__it2)); }
                               ^
f.cc:34:39: error: invalid type argument of unary ‘*’ (have ‘int’)
         { return bool(_M_comp(*__it1, *__it2)); }
                                       ^


So the regression is in the library adding 'constexpr' to _Iter_comp_iter, not
a regression in the compiler, although the problem may be inherent to the
SFINAE constraints in std::function.


It seems that defining the implicit copy constructor of _Iter_comp_iter
performs overload resolution on the function(_Functor) constructor, which
checks the SFINAE constraint, which instantiates
_Iter_comp_iter::operator()<int, int> and that fails if it's constexpr, but
compiles OK otherwise.
>From gcc-bugs-return-485053-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Thu Apr 30 10:07:10 2015
Return-Path: <gcc-bugs-return-485053-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 2971 invoked by alias); 30 Apr 2015 10:07:10 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 2902 invoked by uid 48); 30 Apr 2015 10:07:06 -0000
From: "redi at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/65942] [5/6 Regression] [C++14] cannot use std::function as comparator in algorithms
Date: Thu, 30 Apr 2015 10:07:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: c++
X-Bugzilla-Version: 5.0
X-Bugzilla-Keywords: rejects-valid
X-Bugzilla-Severity: normal
X-Bugzilla-Who: redi at gcc dot gnu.org
X-Bugzilla-Status: NEW
X-Bugzilla-Resolution:
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields:
Message-ID: <bug-65942-4-SMUMVCgfq3@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-65942-4@http.gcc.gnu.org/bugzilla/>
References: <bug-65942-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2015-04/txt/msg02605.txt.bz2
Content-length: 256

https://gcc.gnu.org/bugzilla/show_bug.cgi?ide942

--- Comment #8 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Jonathan Wakely from comment #7)
> Yes, and so do 4.8 and 4.9

That was in response to "clang rejects your testcase, too."


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

* [Bug libstdc++/65942] [5/6 Regression] [C++14] cannot use std::function as comparator in algorithms
  2015-04-30  9:03 [Bug libstdc++/65942] New: cannot use std::function as comparator in algorithms avi@cloudius-systems.com
                   ` (6 preceding siblings ...)
  2015-04-30 10:06 ` redi at gcc dot gnu.org
@ 2015-04-30 10:22 ` redi at gcc dot gnu.org
  2015-05-17 16:16 ` avi@cloudius-systems.com
                   ` (4 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: redi at gcc dot gnu.org @ 2015-04-30 10:22 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
          Component|c++                         |libstdc++

--- Comment #9 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Further reduced:

template<typename _Tp>
  _Tp&& declval() noexcept;

template<typename Arg>
  struct function
  {
    template<typename Functor,
             typename = decltype( declval<Functor&>()(declval<Arg>()) )>
      function(Functor) { }

    function() { }

    bool operator()(Arg) const;
  };


template<typename Compare>
  struct Iter_comp
  {
    Compare m_comp;

    Iter_comp(Compare comp)
      : m_comp(comp)
    { }

    template<typename Iterator>
#ifndef OK
      constexpr
#endif
      bool
      operator()(Iterator it) const
      { return m_comp(*it); }
  };

using F = function<int>;
F f;
Iter_comp<F> c{ f };
auto c2 = c;


GCC says:

f.cc: In instantiation of ‘constexpr bool
Iter_comp<Compare>::operator()(Iterator) const [with Iterator = int; Compare =
function<int>]’:
f.cc:8:52:   required by substitution of ‘template<class Functor, class>
function<Arg>::function(Functor) [with Functor = Iter_comp<function<int> >;
<template-parameter-1-2> = <missing>]’
f.cc:38:11:   required from here
f.cc:32:23: error: invalid type argument of unary ‘*’ (have ‘int’)
       { return m_comp(*it); }
                       ^

and Clang says:

f.cc:32:23: error: indirection requires pointer operand ('int' invalid)
      { return m_comp(*it); }
                      ^~~
f.cc:8:35: note: in instantiation of function template specialization
'Iter_comp<function<int> >::operator()<int>' requested here
             typename = decltype( declval<Functor&>()(declval<Arg>()) )>
                                  ^
f.cc:9:7: note: in instantiation of default argument for
'function<Iter_comp<function<int> > >' required here
      function(Functor) { }
      ^~~~~~~~
f.cc:38:11: note: while substituting deduced template arguments into function
template 'function' [with Functor = Iter_comp<function<int> >, $1 = (no value)]
auto c2 = c;
          ^
1 error generated.



What I don't understand is why function<int>::function<Comp_iter<function<int>>
ever gets considered for overload resolution. Where does that come from and
why?


Anyway, it seems we can fix the library by constraining
_Iter_comp_iter::operator()


    template<typename Iterator, typename =
decltype(declval<Compare&>()(*declval<Iterator>()))>
#ifndef OK
      constexpr
#endif
      bool
      operator()(Iterator it) const
      { return m_comp(*it); }

That prevents it being instantiated as a possible argument to std::function.

Changing component back to libstdc++
>From gcc-bugs-return-485059-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Thu Apr 30 10:35:49 2015
Return-Path: <gcc-bugs-return-485059-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 29484 invoked by alias); 30 Apr 2015 10:35:48 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 29456 invoked by uid 48); 30 Apr 2015 10:35:45 -0000
From: "npl at chello dot at" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/65945] C++ alignment of nullptr_t is 1 and might cause unaligned stores to the frame
Date: Thu, 30 Apr 2015 10:35:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: c++
X-Bugzilla-Version: 4.8.4
X-Bugzilla-Keywords:
X-Bugzilla-Severity: major
X-Bugzilla-Who: npl at chello dot at
X-Bugzilla-Status: UNCONFIRMED
X-Bugzilla-Resolution:
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields:
Message-ID: <bug-65945-4-fCHnFT2WsZ@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-65945-4@http.gcc.gnu.org/bugzilla/>
References: <bug-65945-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2015-04/txt/msg02611.txt.bz2
Content-length: 429

https://gcc.gnu.org/bugzilla/show_bug.cgi?ide945

--- Comment #3 from npl at chello dot at ---
I just checked the alignment of nullptr, and here seems to be the issue:
the size of 4, while the alignment is 1. This will result in unaligned access
should a nullptr be stored (storing a nullptr probably is a really useless
thing, but it seems to happen)

static_assert(std::alignment_of<decltype(nullptr)>::value == 4, "oops");


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

* [Bug libstdc++/65942] [5/6 Regression] [C++14] cannot use std::function as comparator in algorithms
  2015-04-30  9:03 [Bug libstdc++/65942] New: cannot use std::function as comparator in algorithms avi@cloudius-systems.com
                   ` (7 preceding siblings ...)
  2015-04-30 10:22 ` [Bug libstdc++/65942] " redi at gcc dot gnu.org
@ 2015-05-17 16:16 ` avi@cloudius-systems.com
  2015-05-17 20:32 ` harald at gigawatt dot nl
                   ` (3 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: avi@cloudius-systems.com @ 2015-05-17 16:16 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #10 from Avi Kivity <avi@cloudius-systems.com> ---
Any chance that the fix can be committed?  gcc 5 is useless for me without
this.


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

* [Bug libstdc++/65942] [5/6 Regression] [C++14] cannot use std::function as comparator in algorithms
  2015-04-30  9:03 [Bug libstdc++/65942] New: cannot use std::function as comparator in algorithms avi@cloudius-systems.com
                   ` (8 preceding siblings ...)
  2015-05-17 16:16 ` avi@cloudius-systems.com
@ 2015-05-17 20:32 ` harald at gigawatt dot nl
  2015-06-02  2:29 ` jason at gcc dot gnu.org
                   ` (2 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: harald at gigawatt dot nl @ 2015-05-17 20:32 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #12 from Harald van Dijk <harald at gigawatt dot nl> ---
(In reply to Harald van Dijk from comment #11)
> The programs in my comment here are accepted by G++ 4.5.4 (with -std=c++0x),
> and rejected by 4.6.4 and later.

But as G++ 4.5 recognises but simply ignores the constexpr keyword, it's not
really a regression. 4.6 is the first that actually implements constexpr
functions, and it was broken in that version already.


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

* [Bug libstdc++/65942] [5/6 Regression] [C++14] cannot use std::function as comparator in algorithms
  2015-04-30  9:03 [Bug libstdc++/65942] New: cannot use std::function as comparator in algorithms avi@cloudius-systems.com
                   ` (9 preceding siblings ...)
  2015-05-17 20:32 ` harald at gigawatt dot nl
@ 2015-06-02  2:29 ` jason at gcc dot gnu.org
  2015-06-05 16:26 ` jason at gcc dot gnu.org
  2015-06-05 16:26 ` [Bug c++/65942] " jason at gcc dot gnu.org
  12 siblings, 0 replies; 14+ messages in thread
From: jason at gcc dot gnu.org @ 2015-06-02  2:29 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #13 from Jason Merrill <jason at gcc dot gnu.org> ---
Author: jason
Date: Tue Jun  2 02:28:25 2015
New Revision: 224008

URL: https://gcc.gnu.org/viewcvs?rev=224008&root=gcc&view=rev
Log:
        PR c++/65942
        * decl2.c (mark_used): Don't always instantiate constexpr fns.
        * constexpr.c (cxx_eval_call_expression): Instantiate them here.

Added:
    trunk/gcc/testsuite/g++.dg/cpp0x/constexpr-decltype2.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/constexpr.c
    trunk/gcc/cp/decl2.c


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

* [Bug libstdc++/65942] [5/6 Regression] [C++14] cannot use std::function as comparator in algorithms
  2015-04-30  9:03 [Bug libstdc++/65942] New: cannot use std::function as comparator in algorithms avi@cloudius-systems.com
                   ` (10 preceding siblings ...)
  2015-06-02  2:29 ` jason at gcc dot gnu.org
@ 2015-06-05 16:26 ` jason at gcc dot gnu.org
  2015-06-05 16:26 ` [Bug c++/65942] " jason at gcc dot gnu.org
  12 siblings, 0 replies; 14+ messages in thread
From: jason at gcc dot gnu.org @ 2015-06-05 16:26 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #15 from Jason Merrill <jason at gcc dot gnu.org> ---
Author: jason
Date: Fri Jun  5 16:25:26 2015
New Revision: 224157

URL: https://gcc.gnu.org/viewcvs?rev=224157&root=gcc&view=rev
Log:
        PR c++/65942
        * decl2.c (mark_used): Don't always instantiate constexpr fns.
        * constexpr.c (cxx_eval_call_expression): Instantiate them here.

Added:
    branches/gcc-5-branch/gcc/testsuite/g++.dg/cpp0x/constexpr-decltype2.C
Modified:
    branches/gcc-5-branch/gcc/cp/ChangeLog
    branches/gcc-5-branch/gcc/cp/constexpr.c
    branches/gcc-5-branch/gcc/cp/decl2.c


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

* [Bug c++/65942] [5/6 Regression] [C++14] cannot use std::function as comparator in algorithms
  2015-04-30  9:03 [Bug libstdc++/65942] New: cannot use std::function as comparator in algorithms avi@cloudius-systems.com
                   ` (11 preceding siblings ...)
  2015-06-05 16:26 ` jason at gcc dot gnu.org
@ 2015-06-05 16:26 ` jason at gcc dot gnu.org
  12 siblings, 0 replies; 14+ messages in thread
From: jason at gcc dot gnu.org @ 2015-06-05 16:26 UTC (permalink / raw)
  To: gcc-bugs

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

Jason Merrill <jason at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
                 CC|                            |jason at gcc dot gnu.org
          Component|libstdc++                   |c++
         Resolution|---                         |FIXED
           Assignee|redi at gcc dot gnu.org            |jason at gcc dot gnu.org
   Target Milestone|---                         |5.2

--- Comment #16 from Jason Merrill <jason at gcc dot gnu.org> ---
Fixed for 5.2.


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

end of thread, other threads:[~2015-06-05 16:26 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-30  9:03 [Bug libstdc++/65942] New: cannot use std::function as comparator in algorithms avi@cloudius-systems.com
2015-04-30  9:14 ` [Bug libstdc++/65942] [5/6 Regression] [C++14] " redi at gcc dot gnu.org
2015-04-30  9:22 ` redi at gcc dot gnu.org
2015-04-30  9:32 ` [Bug c++/65942] " redi at gcc dot gnu.org
2015-04-30  9:46 ` trippels at gcc dot gnu.org
2015-04-30 10:03 ` avi@cloudius-systems.com
2015-04-30 10:05 ` trippels at gcc dot gnu.org
2015-04-30 10:06 ` redi at gcc dot gnu.org
2015-04-30 10:22 ` [Bug libstdc++/65942] " redi at gcc dot gnu.org
2015-05-17 16:16 ` avi@cloudius-systems.com
2015-05-17 20:32 ` harald at gigawatt dot nl
2015-06-02  2:29 ` jason at gcc dot gnu.org
2015-06-05 16:26 ` jason at gcc dot gnu.org
2015-06-05 16:26 ` [Bug c++/65942] " jason 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).