boostorg / boostorg/date_time

Is -D_GLIBCXX_DEBUG_PEDANTIC supported?

Open
#190 2 comments 1 reaction 0 assignees View on GitHub
Dominant language
C++
Stars
70
Forks
99
PR merge metrics
No merged PRs in 30d

Description

I was wondering if this library supports `-D_GLIBCXX_DEBUG_PEDANTIC` builds. Currently I am seeing a failure. Steps to reproduce:

```
$ cat 2.cpp

#include
#include

int main() {
std::string hex("31393730300b");
std::string str;
boost::algorithm::unhex(hex.begin(), hex.end(), std::back_inserter(str));

const std::locale loc(
std::locale::classic(),
new boost::posix_time::time_input_facet("%Y-%m-%dT%H:%M:%SZ"));
std::istringstream iss(str);
iss.imbue(loc);
boost::posix_time::ptime ptime(boost::date_time::not_a_date_time);
iss >> ptime;
}

$ g++ -D_GLIBCXX_DEBUG -D_GLIBCXX_DEBUG_PEDANTIC -g -std=c++17 -Wall 2.cpp -o exe && valgrind ./exe
==5147== Memcheck, a memory error detector
==5147== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==5147== Using Valgrind-3.15.0 and LibVEX; rerun with -h for copyright info
==5147== Command: ./exe
==5147==
/usr/include/c++/9/bits/streambuf_iterator.h:140:
In function:
std::istreambuf_iterator<_CharT, _Traits>::char_type
std::istreambuf_iterator<_CharT, _Traits>::operator*() const [with
_CharT = char; _Traits = std::char_traits;
std::istreambuf_iterator<_CharT, _Traits>::char_type = char]

Error: attempt to dereference an end-of-stream istreambuf_iterator (this is
a GNU extension).

Objects involved in the operation:
iterator @ 0x0x1fff000300 {
type = std::istreambuf_iterator >;
}
==5147==
==5147== Process terminating with default action of signal 6 (SIGABRT): dumping core
==5147== at 0x4A9118B: raise (raise.c:51)
==5147== by 0x4A70858: abort (abort.c:79)
==5147== by 0x48F0148: ??? (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.28)
==5147== by 0x123E17: std::istreambuf_iterator >::operator*() const (streambuf_iterator.h:140)
==5147== by 0x12570E: boost::date_time::format_date_parser::parse_month(std::istreambuf_iterator >&, std::istreambuf_iterator >&, std::__cxx11::basic_string, std::allocator >, boost::date_time::parse_match_result&) const (format_date_parser.hpp:473)
==5147== by 0x120E3C: boost::date_time::time_input_facet > >::get(std::istreambuf_iterator >&, std::istreambuf_iterator >&, std::ios_base&, boost::posix_time::ptime&, std::__cxx11::basic_string, std::allocator >&, bool) const (time_facet.hpp:1031)
==5147== by 0x11C461: boost::date_time::time_input_facet > >::get(std::istreambuf_iterator >&, std::istreambuf_iterator >&, std::ios_base&, boost::posix_time::ptime&) const (time_facet.hpp:936)
==5147== by 0x119033: std::basic_istream >& boost::posix_time::operator>> >(std::basic_istream >&, boost::posix_time::ptime&) (posix_time_io.hpp:80)
==5147== by 0x11405C: main (2.cpp:15)

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.