On Fri, May 3, 2013 at 7:29 AM, Shriramana Sharma <[email protected]> wrote: > On Thu, May 2, 2013 at 11:37 PM, Dmitri Gribenko <[email protected]> wrote: >> Looks like our attempt to recover from an error leads to a bad >> diagnostic. You can file a bug for a bad diagnostic at >> http://llvm.org/bugs/ > > Hmmm, examining it further I'm not sure functionality-wise it is a bug -- > > I think the situation is that it is not possible to extract a bool > value via the address of the function, so instead of suspecting that > the user might have wanted to convert the function pointer into a > bool, Clang is suspecting that the user wanted to call the function > and convert its return value to a bool, which is OK IMO. > > However, in investigating the reason it is not possible to get a bool > value via the function pointer, I found that it is because one can't > take a pointer to a bound member function apparently, and I ran into > an actually unclear diagnostic by Clang: > > struct A { > void f () {} > virtual void vf () {} > static void sf () {} > } a ; > > int main () > { > if ( & a.f ) {} > if ( & A::f ) {} > if ( & a.vf ) {} > if ( & A::vf ) {} > if ( & a.sf ) {} > if ( & A::sf ) {} > } > > Clang reports: for the lines &a.f and &a.vf: "cannot create a > non-constant pointer to member function", which is not all that clear > IMO -- would it then be possible to create a *constant* pointer? How? > > In this one case GCC is clearer: "ISO C++ forbids taking the address > of a bound member function to form a pointer to member function. Say > â&A::fâ"
Yep, this is already filed here: http://llvm.org/bugs/show_bug.cgi?id=13235 _______________________________________________ cfe-users mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-users
