From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24502 invoked by alias); 21 Jan 2010 15:38:27 -0000 Received: (qmail 24465 invoked by uid 48); 21 Jan 2010 15:38:10 -0000 Date: Thu, 21 Jan 2010 15:38:00 -0000 Message-ID: <20100121153810.24464.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug libstdc++/42819] [C++0x] std::async fails to compile with simple tests, including N3000 example In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "lloyd at randombit dot net" 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: 2010-01/txt/msg02606.txt.bz2 ------- Comment #8 from lloyd at randombit dot net 2010-01-21 15:38 ------- Jon (and Paolo) - thanks for doing the work! Is there an easy workaround I can apply locally for this? I tried replacing all instances of `typename _Fn::result_type` with `typename result_of<_Fn(_Args...)>::type` in future just to see if I can get things going for me locally, but then get this error on the N3000 example: In file included from /usr/local/gcc-4.5-r156097/lib/gcc/x86_64-unknown-linux-gnu/4.5.0/../../../../include/c++/4.5.0/future.2:38:0, from n3000.cpp:1: /usr/local/gcc-4.5-r156097/lib/gcc/x86_64-unknown-linux-gnu/4.5.0/../../../../include/c++/4.5.0/functional: In instantiation of 'std::result_of)>': /usr/local/gcc-4.5-r156097/lib/gcc/x86_64-unknown-linux-gnu/4.5.0/../../../../include/c++/4.5.0/future.2:1328:41: instantiated from 'std::future::type> std::async(_Fn&&, _Args&& ...) [with _Fn = work(int)::, _Args = {}, typename std::result_of<_Functor(_ArgTypes ...)>::type = int]' n3000.cpp:17:57: instantiated from here /usr/local/gcc-4.5-r156097/lib/gcc/x86_64-unknown-linux-gnu/4.5.0/../../../../include/c++/4.5.0/functional:183:9: error: 'std::declval [with _Tp = std::launch, typename std::add_rvalue_reference<_Tp>::type = std::launch&&]()' cannot be used as a function I'm not sure if I have messed this up (my C++0x-fu is still very weak), or if functional's result_of needs further changes to support this case - it looks to be using decltype now (a recent change I think; thanks again!) so I had guessed this would 'just work', but I had never even heard of declval and looking at type_traits can't quite grok what it's doing or why this isn't happy. Simple test cases I've tried using result_of on global functions and lambdas seem to work so I'm having a hard time narrowing it down. Thus this comment. :) -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42819