Opened 10 years ago

Last modified 9 years ago

#8021 new Bugs

gcc: ptree_utils.hpp:76: warning: comparison is always false due to limited range of data type [-Wtype-limits]

Reported by: anonymous Owned by: Sebastian Redl
Milestone: To Be Determined Component: property_tree
Version: Boost 1.52.0 Severity: Problem
Keywords: Cc: mateusz@…

Description (last modified by Mateusz Loskot)

gcc version 4.7.2 (Built by MinGW-builds project) i686-w64-mingw32

yields

boost/property_tree/detail/ptree_utils.hpp: In instantiation of 'std::string boost::property_tree::detail::narrow(const Ch*) [with Ch = wchar_t; std::string = std::basic_string<char>]':
boost/property_tree/string_path.hpp:64:36:   required from here
boost/property_tree/detail/ptree_utils.hpp:76:13: warning: comparison is always false due to limited range of data type [-Wtype-limits]

76: if (*text < 0 || *text > (std::numeric_limits<char>::max)())

Attachments (1)

boost-8021a.diff (1.2 KB ) - added by kailoran@… 10 years ago.
C++11-only patch to fix the warning

Download all attachments as: .zip

Change History (5)

by kailoran@…, 10 years ago

Attachment: boost-8021a.diff added

C++11-only patch to fix the warning

comment:1 by Gaurav Gupta <g.gupta@…>, 9 years ago

I also faced this warning, with some Arm compiler. I applied a temporary fix by adding #pragma Macros in the header file.

comment:2 by Mateusz Loskot, 9 years ago

Description: modified (diff)

comment:3 by Gaurav Gupta <g.gupta@…>, 9 years ago

I removed this warning as below:

#if defined(_MSC_VER) && (_MSC_VER >= 1020) # pragma once #else for GCC compiler, treat as 'system header' to avoid compiler warnings in boost code # pragma GCC system_header #endif

comment:4 by Mateusz Loskot, 9 years ago

Cc: mateusz@… added
Note: See TracTickets for help on using tickets.