Fix valptridx build break in <gcc-7
gcc before gcc-7 failed to build valptridx: ``` common/include/valptridx.h: In instantiation of 'valptridx<managed_type>::ptridx<policy>::ptridx(const valptridx<managed_type>::ptridx<rpolicy>&) [with rpolicy = valptridx<dcx::segment>::vm; typename std::enable_if<(policy:: allow_nullptr || (! rpolicy:: allow_nullptr)), int>::type <anonymous> = 0; policy = valptridx<dcx::segment>::vc; managed_type = dcx::segment]': similar/main/endlevel.cpp:586:105: required from here common/include/valptridx.h:686:14: error: 'using vptr_type = class valptridx<dcx::segment>::ptr<valptridx<dcx::segment>::vm>' is protected within this context vptr_type(static_cast<const typename ptridx<rpolicy>::vptr_type &>(rhs)), ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ common/include/valptridx.h:666:31: note: declared protected here using vptr_type = ptr<policy>; ``` This cannot be fixed in the obvious way because the error message is wrong: ``` 664 using containing_type = valptridx<managed_type>; 665 public: 666 using vptr_type = ptr<policy>; 667 using vidx_type = idx<policy>; 668 using typename vidx_type::array_managed_type; ``` The type declarations _already are_ *public*, not *protected* as the message states. Relaxing the protection on the containing class resolves the error. This looks bad from an encapsulation perspective, but does not make the code incorrect.
This commit is contained in:
parent
915172478f
commit
03b6e604eb
|
@ -59,10 +59,6 @@ class valptridx :
|
|||
class guarded;
|
||||
class array_base_count_type;
|
||||
using array_base_storage_type = std::array<managed_type, array_size>;
|
||||
public:
|
||||
class array_managed_type;
|
||||
using typename specialized_types::report_error_uses_exception;
|
||||
|
||||
protected:
|
||||
using const_pointer_type = const managed_type *;
|
||||
using const_reference_type = const managed_type &;
|
||||
|
@ -74,6 +70,9 @@ protected:
|
|||
using typename specialized_types::integral_type;
|
||||
using index_type = integral_type; // deprecated; should be dedicated UDT
|
||||
|
||||
public:
|
||||
class array_managed_type;
|
||||
using typename specialized_types::report_error_uses_exception;
|
||||
/* ptridx<policy> publicly inherits from idx<policy> and
|
||||
* ptr<policy>, but should not be implicitly sliced to one of the
|
||||
* base types. To prevent slicing, define
|
||||
|
@ -88,6 +87,7 @@ protected:
|
|||
class ptr;
|
||||
template <typename policy>
|
||||
class ptridx;
|
||||
protected:
|
||||
template <typename Pc, typename Pm>
|
||||
class basic_ival_member_factory;
|
||||
template <typename Pc, typename Pm>
|
||||
|
|
Loading…
Reference in a new issue