From 03b6e604ebf7780db8d827f23612f7787a51f6aa Mon Sep 17 00:00:00 2001 From: Kp Date: Fri, 24 Jan 2020 03:49:32 +0000 Subject: [PATCH] Fix valptridx build break in ::ptridx::ptridx(const valptridx::ptridx&) [with rpolicy = valptridx::vm; typename std::enable_if<(policy:: allow_nullptr || (! rpolicy:: allow_nullptr)), int>::type = 0; policy = valptridx::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::ptr::vm>' is protected within this context vptr_type(static_cast::vptr_type &>(rhs)), ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ common/include/valptridx.h:666:31: note: declared protected here using vptr_type = ptr; ``` This cannot be fixed in the obvious way because the error message is wrong: ``` 664 using containing_type = valptridx; 665 public: 666 using vptr_type = ptr; 667 using vidx_type = idx; 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. --- common/include/fwd-valptridx.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/common/include/fwd-valptridx.h b/common/include/fwd-valptridx.h index 58abdcdd0..af6124f2a 100644 --- a/common/include/fwd-valptridx.h +++ b/common/include/fwd-valptridx.h @@ -59,10 +59,6 @@ class valptridx : class guarded; class array_base_count_type; using array_base_storage_type = std::array; -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 publicly inherits from idx and * ptr, but should not be implicitly sliced to one of the * base types. To prevent slicing, define @@ -88,6 +87,7 @@ protected: class ptr; template class ptridx; +protected: template class basic_ival_member_factory; template