Open adah1972 opened 5 years ago
The problem is gone after I add const
to the definition of pointer_type
, reference
, operator*
, and operator->()
of istream_line_reader::iterator
(thanks to Eric’s help):
typedef const value_type* pointer_type;
typedef const value_type& reference;
…
reference operator*() const
{
assert(_M_stream != nullptr);
return _M_line;
}
pointer_type operator->() const
{
assert(_M_stream != nullptr);
return &_M_line;
}
It still feels strange why checking concept could cause compilation errors. . . .
You are right; it shouldn't be a hard error. I had overlooked that part of your bug report. I or @CaseyCarter will investigate.
The following code shows a compilation problem:
I intend to check which concepts are satisfied. However, the line
TEST_CONCEPT(SizedRange, decltype(rng));
(marked above) does not compile. I expect to see it compile and outputfalse
at run time.Which one is at fault, my code, CMCSTL2, or GCC? I doubt it is GCC this time, but I would like to hear experts’ opinions.