boostorg / boostorg/detail

do_length is not correctly overridden?

Open
#14 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
12
Forks
51
PR merge metrics
No merged PRs in 30d

Description

I have two independent builds reporting this error in Boost.Uuid, which includes this header from Boost.Serialization, which includes a header from Boost.Detail:
```
clang-linux.compile.c++.without-pth bin.v2/libs/serialization/build/clang-gnu-linux-3.9.0/debug/cxxstd-03/threadapi-pthread/utf8_codecvt_facet.o
In file included from libs/serialization/src/utf8_codecvt_facet.cpp:19:
In file included from ./boost/detail/utf8_codecvt_facet.ipp:13:
./boost/detail/utf8_codecvt_facet.hpp:181:17: warning: 'boost::archive::detail::utf8_codecvt_facet::do_length' hides overloaded virtual function [-Woverloaded-virtual]
virtual int do_length(
^
/usr/lib/gcc/x86_64-linux-gnu/7.2.0/../../../../include/c++/7.2.0/bits/codecvt.h:453:11: note: hidden overloaded virtual function 'std::codecvt::do_length' declared here: type mismatch at 1st parameter ('state_type &' (aka '__mbstate_t &') vs 'const std::mbstate_t &' (aka 'const __mbstate_t &'))
int do_length(state_type&, const extern_type* __from,
^
1 warning generated.
```

This same issue was identified by Coverity Scan as well.
The build job that identified it: https://travis-ci.org/jeking3/uuid/jobs/293338558

Thanks.

@robertramey it looks like you made the original module - can you take a quick look? In Coverity Scan the failure was reported against libstdc++-4.8 and here it is version 7.2.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start in boost/detail/utf8_codecvt_facet.hpp and boost/detail/utf8_codecvt_facet.ipp, then compare the do_length declaration with the std::codecvt signature shown in the compiler warning. Reproduce the clang build from the linked Travis job and verify that the overloaded-virtual warning is gone and the reported Coverity issue is addressed.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.