public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/49058] New: [C++0x] Bind no-arguments functor failed using std::bind with -pedantic option.
@ 2011-05-19  7:27 flast at flast dot jp
  2011-05-19 12:04 ` [Bug c++/49058] " redi at gcc dot gnu.org
                   ` (22 more replies)
  0 siblings, 23 replies; 24+ messages in thread
From: flast at flast dot jp @ 2011-05-19  7:27 UTC (permalink / raw)
  To: gcc-bugs

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

           Summary: [C++0x] Bind no-arguments functor failed using
                    std::bind with -pedantic option.
           Product: gcc
           Version: 4.5.4
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: flast@flast.jp


GCC rejects following code with -pedantic option.

==== testcase.cc ====
#include <functional>

struct F
{
    void
    operator()();
};

void f()
{
    std::bind( F() );
}
====

==== output ====
$ g++-4.5 -std=c++0x -pedantic testcase.cc
In file included from testcase.cc:1:0:
/usr/local/lib/gcc/i686-pc-linux-gnu/4.5.4/../../../../include/c++/4.5.4/functional:
In instantiation of 'std::_Bind<F()>':
testcase.cc:11:20:   instantiated from here
/usr/local/lib/gcc/i686-pc-linux-gnu/4.5.4/../../../../include/c++/4.5.4/functional:1174:39:
error: no match for call to '(const F) ()'
testcase.cc:5:5: note: candidate is: void F::operator()() <near match>
====

After GCC 4.6, also faild with no-arguments lambda-expression.

==== testcase.cc ====
#include <functional>

void f()
{
    std::bind( []{} );
}
====

==== output ====
$ g++-4.6 -std=c++0x -pedantic testcase.cc
In file included from testcase.cc:1:0:
/usr/local/lib/gcc/i686-pc-linux-gnu/4.6.1/../../../../include/c++/4.6.1/functional:
In instantiation of 'std::_Bind<f()::<lambda()>()>':
testcase.cc:5:21:   instantiated from here
/usr/local/lib/gcc/i686-pc-linux-gnu/4.6.1/../../../../include/c++/4.6.1/functional:1227:32:
error: no match for call to '(volatile f()::<lambda()>) ()'
testcase.cc:5:17: note: candidates are:
/usr/local/lib/gcc/i686-pc-linux-gnu/4.6.1/../../../../include/c++/4.6.1/functional:1227:32:
note: void (*)() <conversion>
/usr/local/lib/gcc/i686-pc-linux-gnu/4.6.1/../../../../include/c++/4.6.1/functional:1227:32:
note:   candidate expects 0 arguments, 1 provided
testcase.cc:5:17: note: f()::<lambda()> <near match>
testcase.cc:5:17: note:   no known conversion for implicit 'this' parameter
from 'volatile f()::<lambda()>*' to 'const f()::<lambda()>*'
/usr/local/lib/gcc/i686-pc-linux-gnu/4.6.1/../../../../include/c++/4.6.1/functional:
In instantiation of 'std::_Bind<f()::<lambda()>()>':
testcase.cc:5:21:   instantiated from here
/usr/local/lib/gcc/i686-pc-linux-gnu/4.6.1/../../../../include/c++/4.6.1/functional:1240:38:
error: no match for call to '(const volatile f()::<lambda()>) ()'
testcase.cc:5:17: note: candidates are:
/usr/local/lib/gcc/i686-pc-linux-gnu/4.6.1/../../../../include/c++/4.6.1/functional:1240:38:
note: void (*)() <conversion>
/usr/local/lib/gcc/i686-pc-linux-gnu/4.6.1/../../../../include/c++/4.6.1/functional:1240:38:
note:   candidate expects 0 arguments, 1 provided
testcase.cc:5:17: note: f()::<lambda()> <near match>
testcase.cc:5:17: note:   no known conversion for implicit 'this' parameter
from 'const volatile f()::<lambda()>*' to 'const f()::<lambda()>*'
====

gcc-4.5 (GCC) 4.5.4 20110512 (prerelease) - Failed
gcc-4.6 (GCC) 4.6.1 20110513 (prerelease) - Failed
gcc-4.7 (GCC) 4.7.0 20110517 (experimental) - Failed


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

end of thread, other threads:[~2011-05-25  0:00 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-19  7:27 [Bug c++/49058] New: [C++0x] Bind no-arguments functor failed using std::bind with -pedantic option flast at flast dot jp
2011-05-19 12:04 ` [Bug c++/49058] " redi at gcc dot gnu.org
2011-05-19 15:59 ` jason at gcc dot gnu.org
2011-05-19 16:23 ` jason at gcc dot gnu.org
2011-05-19 16:24 ` [Bug libstdc++/49058] " jason at gcc dot gnu.org
2011-05-19 16:37 ` jason at gcc dot gnu.org
2011-05-19 17:19 ` redi at gcc dot gnu.org
2011-05-22 21:02 ` paolo.carlini at oracle dot com
2011-05-22 21:45 ` redi at gcc dot gnu.org
2011-05-22 21:52 ` redi at gcc dot gnu.org
2011-05-22 21:53 ` redi at gcc dot gnu.org
2011-05-22 22:05 ` redi at gcc dot gnu.org
2011-05-22 22:10 ` paolo.carlini at oracle dot com
2011-05-22 22:35 ` paolo.carlini at oracle dot com
2011-05-22 22:51 ` paolo.carlini at oracle dot com
2011-05-22 23:17 ` paolo.carlini at oracle dot com
2011-05-22 23:47 ` paolo.carlini at oracle dot com
2011-05-23  0:02 ` redi at gcc dot gnu.org
2011-05-23  0:30 ` paolo at gcc dot gnu.org
2011-05-23  0:42 ` paolo.carlini at oracle dot com
2011-05-23  0:46 ` paolo.carlini at oracle dot com
2011-05-23  0:47 ` paolo at gcc dot gnu.org
2011-05-23 15:58 ` jason at gcc dot gnu.org
2011-05-25  0:05 ` paolo.carlini at oracle dot com

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).