martinmoene / lest

A modern, C++11-native, single-file header-only, tiny framework for unit-tests, TDD and BDD (includes C++98 variant)
Boost Software License 1.0
390 stars 45 forks source link

fix warnings #9

Closed miguelmartin75 closed 10 years ago

miguelmartin75 commented 10 years ago

I get the following warnings when using lest.

lest.hpp:390:68: warning:
      equality comparison result unused [-Wunused-comparison]
  ...test( int ) -> decltype( std::declval<U>().begin() == std::declval<U>().end(), std...
                              ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
lest.hpp:415:47: note: in
      instantiation of template class 'lest::is_container<std::__1::basic_string<char> >'
      requested here
using ForContainer = typename std::enable_if< is_container<T>::value, R>::type;
                                              ^
lest.hpp:465:37: note: in
      instantiation of template type alias 'ForContainer' requested here
auto to_string( C const & cont ) -> ForContainer<C, std::string>
                                    ^
lest.hpp:486:12: note: while
      substituting deduced template arguments into function template 'to_string' [with C =
      std::__1::basic_string<char>]
    return to_string( result );
           ^
lest.hpp:390:68: warning:
      equality comparison result unused [-Wunused-comparison]
  ...test( int ) -> decltype( std::declval<U>().begin() == std::declval<U>().end(), std...
                              ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~

I'm using Apple clang on OS X 10.9.5:

Apple LLVM version 6.0 (clang-600.0.51) (based on LLVM 3.5svn)
Target: x86_64-apple-darwin13.4.0
Thread model: posix
martinmoene commented 10 years ago

Hi Miguel,

After adding # pragma clang diagnostic ignored "-Wunused-comparison" to lest.hpp I discovered that the Makefile used by Travis CI didn't build test_lest anymore. After fixing that it appeared that clang trips over std::underlying_type<>, whereas on Windows, g++ (GCC) 4.8.1 and Visual C++ 12 (Visual Studio 2013) succeed.

As I don't have access to clang it would be very helpful if you could tell me the result for your environment.

Thanks in advance, Martin

Edit 26-Sep-2014: Moved to issue #10 .

miguelmartin75 commented 10 years ago

Your fixes seems to have removed the warnings. Thanks :)

martinmoene commented 10 years ago

Thanks for telling!