This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/49058] [C++0x] Bind no-arguments functor failed using std::bind with -pedantic option.


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]