This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/49058] [C++0x] Bind no-arguments functor failed using std::bind with -pedantic option.
- From: "jason at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 19 May 2011 15:57:07 +0000
- Subject: [Bug c++/49058] [C++0x] Bind no-arguments functor failed using std::bind with -pedantic option.
- Auto-submitted: auto-generated
- References: <bug-49058-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49058
Jason Merrill <jason at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |ASSIGNED
Last reconfirmed| |2011.05.19 15:43:41
AssignedTo|unassigned at gcc dot |jason at gcc dot gnu.org
|gnu.org |
Ever Confirmed|0 |1
--- Comment #2 from Jason Merrill <jason at gcc dot gnu.org> 2011-05-19 15:43:41 UTC ---
This has nothing to do with variadics; the same error occurs with
template<typename T> T val();
struct F1
{
void operator()();
};
template<typename F>
struct Bind
{
template<typename R
= decltype( val<F>()( ) )>
R f();
template<typename R
= decltype( val<const F>()( ) )>
R f() const;
};
int main()
{
Bind<F1>().f();
}
The problem is that F1::operator() is non-const, so when we instantiate
Bind<F1>, val<const F>() is ill-formed. And this error is not dependent on
EDG also rejects this testcase. The bug is that we silently accept it without
-pedantic; we should be giving a pedwarn.