Bug 42761 - std::bind doesn't work for simple class types
Summary: std::bind doesn't work for simple class types
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.5.0
: P1 blocker
Target Milestone: 4.5.0
Assignee: Jason Merrill
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-01-15 18:13 UTC by Paolo Carlini
Modified: 2010-01-16 17:19 UTC (History)
4 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2010-01-15 20:15:03


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Paolo Carlini 2010-01-15 18:13:29 UTC
Unfortunately, this very simple example, which we have been discussing for other reasons, regresses very badly vs tr1. Unfortunately the C++ front-end doesn't seem ready for a conforming result_of :( Can we prepare a reduced testcase for Jason?

Maybe he can already tell us whether an error message of the form: "sorry, unimplemented: unable to determine the declared type of expression ‘declval<X>()()’" points to an issue fixable any time soon...

Otherwise, I'm afraid that for 4.5.0 we have to revert consistently most C++0x work in <functional>.

///////////////

#include <functional>

struct X {
  typedef int result_type;
  int operator()() { return 0; }
  int operator()() const { return 1; }
};

const auto b = std::bind(X());

b(); // b is const, so must return 1
Comment 1 Jonathan Wakely 2010-01-15 18:34:08 UTC
OK, I'll revert it all tomorrow if necessary
Comment 2 Paolo Carlini 2010-01-15 20:25:13 UTC
Thanks Jason! If we manage to solve this tough problem, then I know how to enable also the volatile / const volatile call operators + other improvements bringing us real close to the WP.
Comment 3 Jason Merrill 2010-01-16 15:23:33 UTC
Subject: Bug 42761

Author: jason
Date: Sat Jan 16 15:23:19 2010
New Revision: 155966

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=155966
Log:
	PR c++/42761
	* semantics.c (finish_decltype_type): Within a template, treat
	unresolved CALL_EXPR as dependent.

Added:
    trunk/gcc/testsuite/g++.dg/cpp0x/decltype22.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/semantics.c
    trunk/gcc/testsuite/ChangeLog

Comment 4 Jason Merrill 2010-01-16 15:24:09 UTC
Fixed.
Comment 5 Jonathan Wakely 2010-01-16 17:19:26 UTC
Thanks, Jason!

Paolo, what's the trick I missed to make the volatile overloads work?