[cfe-users] Converting a function name to boolean

Shriramana Sharma samjnaa at gmail.com
Thu May 2 09:41:12 PDT 2013


Hello. This is my first post here. First let me express my very many
thanks and congratulations to all those who have developed Clang so
excellently. I've only recently started using it over GCC, and I have
to say I am most pleased. I am also happy to note that Debian's
Clang-compilability is being actively tested
(http://clang.debian.net/) since I'm using Kubuntu.

OK now to my query:

I'm using Clang 3.2 (3.2-1~exp9ubuntu1) on Kubuntu Raring on a 64 bit system.

Please examine the attached C++ test program which includes the Clang
vs GCC (4.7.3-1ubuntu1) outputs too. Since Clang is far stricter with
the standard than GCC I've been using it to compile my projects and it
recently gave this error "reference to non-static member function must
be called", based on which I made up this testcase.

Normally Clang's error messages are much more useful than GCC, but in
this case, GCC clearly says that it can't convert a function of the
given type into a bool upon seeing that the expression is used in an
if() tests, whereas Clang talks about a reference to non-static member
needing to be called. I don't get what is the meaning or relevance of
the error message. Can anyone please explain? (I also note that if the
function takes no arguments, there is a suggestion appended to the
error message: whether I meant to call it with no arguments.)

Thanks a lot!

-- 
Shriramana Sharma ஶ்ரீரமணஶர்மா श्रीरमणशर्मा
-------------- next part --------------
A non-text attachment was scrubbed...
Name: function-boolean-conversion.cpp
Type: text/x-c++src
Size: 2800 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-users/attachments/20130502/f90cc83c/attachment.cpp>


More information about the cfe-users mailing list