Opened 8 years ago

Closed 5 years ago

#10154 closed Bugs (invalid)

Compilation error in gregorian_calendar.ipp: is_leap_year

Reported by: anonymous Owned by: James E. King, III
Milestone: To Be Determined Component: date_time
Version: Boost 1.55.0 Severity: Problem
Keywords: Cc:

Description

Using visual studio 2013, I get the following compilation error:

1>C:\Libs\CLibs\boost_1.55.0\include\boost/date_time/gregorian_calendar.ipp(167): error C2675: unary '!' : 'boost::type' does not define this operator or a conversion to a type acceptable to the predefined operator 1> C:\Libs\CLibs\boost_1.55.0\include\boost/date_time/gregorian_calendar.ipp(165) : while compiling class template member function 'bool boost::date_time::gregorian_calendar_base<boost::gregorian::greg_year_month_day,unsigned int>::is_leap_year(boost::gregorian::greg_year)' 1> C:\Libs\CLibs\boost_1.55.0\include\boost/date_time/gregorian_calendar.ipp(51) : see reference to function template instantiation 'bool boost::date_time::gregorian_calendar_base<boost::gregorian::greg_year_month_day,unsigned int>::is_leap_year(boost::gregorian::greg_year)' being compiled 1> C:\Libs\CLibs\boost_1.55.0\include\boost/date_time/gregorian_calendar.ipp(22) : while compiling class template member function 'unsigned short boost::date_time::gregorian_calendar_base<boost::gregorian::greg_year_month_day,unsigned int>::day_of_week(const boost::date_time::year_month_day_base<boost::gregorian::greg_year,boost::gregorian::greg_month,boost::gregorian::greg_day> &)' 1> C:\Libs\CLibs\boost_1.55.0\include\boost/date_time/date.hpp(95) : see reference to function template instantiation 'unsigned short boost::date_time::gregorian_calendar_base<boost::gregorian::greg_year_month_day,unsigned int>::day_of_week(const boost::date_time::year_month_day_base<boost::gregorian::greg_year,boost::gregorian::greg_month,boost::gregorian::greg_day> &)' being compiled 1> C:\Libs\CLibs\boost_1.55.0\include\boost/date_time/gregorian/greg_calendar.hpp(27) : see reference to class template instantiation 'boost::date_time::gregorian_calendar_base<boost::gregorian::greg_year_month_day,unsigned int>' being compiled

---

Include tree:

"C:
Libs
CLibs
boost_1.55.0
include
boost/thread.hpp" "C:
Libs
CLibs
boost_1.55.0
include
boost/thread/thread.hpp" "C:
Libs
CLibs
boost_1.55.0
include
boost/thread/thread_only.hpp" "C:
Libs
CLibs
boost_1.55.0
include
boost/thread/win32/thread_data.hpp" "C:
Libs
CLibs
boost_1.55.0
include
boost/thread/thread_time.hpp" "C:
Libs
CLibs
boost_1.55.0
include
boost/date_time/posix_time/posix_tim e_types.hpp" "C:
Libs
CLibs
boost_1.55.0
include
boost/date_time/posix_time/ptime.hpp " "C:
Libs
CLibs
boost_1.55.0
include
boost/date_time/posix_time/posix_tim e_system.hpp" "C:
Libs
CLibs
boost_1.55.0
include
boost/date_time/posix_time/posix_ti me_config.hpp" "C:
Libs
CLibs
boost_1.55.0
include
boost/date_time/gregorian/gregorian _types.hpp" "C:
Libs
CLibs
boost_1.55.0
include
boost/date_time/gregorian/greg_cale ndar.hpp" "C:
Libs
CLibs
boost_1.55.0
include
boost/date_time/gregorian_calendar.h pp" "C:
Libs
CLibs
boost_1.55.0
include
boost/date_time/gregorian_calendar.i pp"

---

Changing the line 167 to:

return (!((unsigned short)year % 4)) && (((unsigned short)year % 100)
(!((unsigned short)year % 400)));

... fixes the problem.

Change History (3)

comment:1 by anonymous, 8 years ago

I had set the following preprocessor definitions:

WIN32;_DEBUG;_WIN32_WINNT=0x0501;_WINDLL;

comment:2 by James E. King, III, 5 years ago

Owner: changed from az_sw_dude to James E. King, III

comment:3 by James E. King, III, 5 years ago

Resolution: invalid
Status: newclosed

Please provide sample code (a unit test in date_time is preferred) to show how it was called. Given the report is anonymous, resolving as invalid.

Note: See TracTickets for help on using tickets.