public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/58569] New: Compilation error when copying class which contains multiple std::function
@ 2013-09-28 20:16 pierre.krieger1708 at gmail dot com
  2013-09-28 23:53 ` [Bug c++/58569] Compilation error when a class " redi at gcc dot gnu.org
                   ` (17 more replies)
  0 siblings, 18 replies; 19+ messages in thread
From: pierre.krieger1708 at gmail dot com @ 2013-09-28 20:16 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58569

            Bug ID: 58569
           Summary: Compilation error when copying class which contains
                    multiple std::function
           Product: gcc
           Version: 4.8.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: pierre.krieger1708 at gmail dot com

Created attachment 30924
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=30924&action=edit
The preprocessed file

This simple code snippet fails to compile:


#include <functional>

struct foo {
  std::function<foo (int)> x;
  std::function<foo ()> y;
};

int main(int argc, char const* argv[]) {
  foo a;  
  return 0;
}


The problem happens if a class contains at least two std::function of different
type which return the class itself.

If you remove the "int" from "foo (int)", it works. If you remove either member
"x" or "y", it works.


With g++4.8.1 and flag -std=c++11:

In file included from test.cpp:1:0:
/usr/include/c++/4.8/functional: In instantiation of ‘struct
std::function<foo()>::_CheckResult<foo, foo>’:
/usr/include/c++/4.8/functional:2192:63:   required by substitution of
‘template<class _Res, class ... _ArgTypes> template<class _Cond, class _Tp>
using _Requires = typename std::enable_if<_Cond:: value, _Tp>::type [with _Cond
= std::function<foo()>::_CheckResult<foo, foo>; _Tp = void; _Res = foo;
_ArgTypes = {}]’
/usr/include/c++/4.8/functional:2254:9:   required by substitution of
‘template<class _From1, class _To1> static decltype
((__test_aux<_To1>(declval<_From1>()), std::__sfinae_types::__one()))
std::__is_convertible_helper<_From, _To, false>::__test(int) [with _From1 =
_From1; _To1 = _To1; _From = foo; _To = foo] [with _From1 = foo; _To1 = foo]’
/usr/include/c++/4.8/type_traits:1312:50:   required from ‘constexpr const bool
std::__is_convertible_helper<foo, foo, false>::value’
/usr/include/c++/4.8/type_traits:1317:12:   required from ‘struct
std::is_convertible<foo, foo>’
/usr/include/c++/4.8/functional:2181:9:   required from ‘struct
std::function<foo(int)>::_CheckResult<foo, foo>’
/usr/include/c++/4.8/functional:2192:63:   required by substitution of
‘template<class _Res, class ... _ArgTypes> template<class _Cond, class _Tp>
using _Requires = typename std::enable_if<_Cond:: value, _Tp>::type [with _Cond
= std::function<foo(int)>::_CheckResult<foo, foo>; _Tp = void; _Res = foo;
_ArgTypes = {int}]’
/usr/include/c++/4.8/functional:2254:9:   required from here
/usr/include/c++/4.8/functional:2181:9: error: invalid use of incomplete type
‘struct std::is_convertible<foo, foo>’
  struct _CheckResult
         ^
In file included from /usr/include/c++/4.8/bits/move.h:57:0,
                 from /usr/include/c++/4.8/bits/stl_pair.h:59,
                 from /usr/include/c++/4.8/utility:70,
                 from /usr/include/c++/4.8/tuple:38,
                 from /usr/include/c++/4.8/functional:55,
                 from test.cpp:1:
/usr/include/c++/4.8/type_traits:1317:12: error: declaration of ‘struct
std::is_convertible<foo, foo>’
     struct is_convertible
            ^
/usr/include/c++/4.8/type_traits: In substitution of ‘template<class _From1,
class _To1> static decltype ((__test_aux<_To1>(declval<_From1>()),
std::__sfinae_types::__one())) std::__is_convertible_helper<_From, _To,
false>::__test(int) [with _From1 = _From1; _To1 = _To1; _From = foo; _To = foo]
[with _From1 = foo; _To1 = foo]’:
/usr/include/c++/4.8/type_traits:1312:50:   required from ‘constexpr const bool
std::__is_convertible_helper<foo, foo, false>::value’
/usr/include/c++/4.8/type_traits:1317:12:   required from ‘struct
std::is_convertible<foo, foo>’
/usr/include/c++/4.8/functional:2181:9:   required from ‘struct
std::function<foo(int)>::_CheckResult<foo, foo>’
/usr/include/c++/4.8/functional:2192:63:   required by substitution of
‘template<class _Res, class ... _ArgTypes> template<class _Cond, class _Tp>
using _Requires = typename std::enable_if<_Cond:: value, _Tp>::type [with _Cond
= std::function<foo(int)>::_CheckResult<foo, foo>; _Tp = void; _Res = foo;
_ArgTypes = {int}]’
/usr/include/c++/4.8/functional:2254:9:   required from here
/usr/include/c++/4.8/type_traits:1302:21: error:   initializing argument 1 of
‘static void std::__is_convertible_helper<_From, _To, false>::__test_aux(_To1)
[with _To1 = foo; _From = foo; _To = foo]’
         static void __test_aux(_To1);
>From gcc-bugs-return-430734-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Sat Sep 28 20:17:58 2013
Return-Path: <gcc-bugs-return-430734-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 4291 invoked by alias); 28 Sep 2013 20:17:58 -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 4256 invoked by uid 48); 28 Sep 2013 20:17:55 -0000
From: "reichelt at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/58500] [C++1y] Crash with auto in function parameter
Date: Sat, 28 Sep 2013 20:17: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.9.0
X-Bugzilla-Keywords: ice-on-valid-code
X-Bugzilla-Severity: normal
X-Bugzilla-Who: reichelt at gcc dot gnu.org
X-Bugzilla-Status: RESOLVED
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: 4.9.0
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields: bug_status cf_known_to_work resolution target_milestone
Message-ID: <bug-58500-4-HN5xNBXEqs@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-58500-4@http.gcc.gnu.org/bugzilla/>
References: <bug-58500-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: 2013-09/txt/msg01974.txt.bz2
Content-length: 557

http://gcc.gnu.org/bugzilla/show_bug.cgi?idX500

Volker Reichelt <reichelt at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
      Known to work|                            |4.9.0
         Resolution|---                         |FIXED
   Target Milestone|---                         |4.9.0

--- Comment #3 from Volker Reichelt <reichelt at gcc dot gnu.org> ---
Fixed by Adam's patch.


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

end of thread, other threads:[~2013-10-02 20:23 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-09-28 20:16 [Bug c++/58569] New: Compilation error when copying class which contains multiple std::function pierre.krieger1708 at gmail dot com
2013-09-28 23:53 ` [Bug c++/58569] Compilation error when a class " redi at gcc dot gnu.org
2013-10-01  6:39 ` paolo.carlini at oracle dot com
2013-10-01  7:01 ` redi at gcc dot gnu.org
2013-10-01  7:11 ` daniel.kruegler at googlemail dot com
2013-10-01  7:46 ` redi at gcc dot gnu.org
2013-10-01  7:49 ` daniel.kruegler at googlemail dot com
2013-10-01  8:04 ` redi at gcc dot gnu.org
2013-10-01  8:10 ` redi at gcc dot gnu.org
2013-10-01  8:12 ` redi at gcc dot gnu.org
2013-10-01  8:26 ` redi at gcc dot gnu.org
2013-10-01  8:32 ` daniel.kruegler at googlemail dot com
2013-10-01  8:52 ` redi at gcc dot gnu.org
2013-10-01  8:57 ` daniel.kruegler at googlemail dot com
2013-10-01  9:17 ` daniel.kruegler at googlemail dot com
2013-10-01 13:01 ` [Bug libstdc++/58569] " paolo.carlini at oracle dot com
2013-10-02 20:22 ` redi at gcc dot gnu.org
2013-10-02 20:22 ` redi at gcc dot gnu.org
2013-10-02 20:23 ` 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).