From 3aedadf4f2c1e8846016d80af6662251e0373334 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carsten=20Gr=C3=A4ser?= <graeser@dune-project.org> Date: Mon, 12 Sep 2016 11:04:53 +0200 Subject: [PATCH] [comment] Fix comment: This is a downcast This is in fact an _unsafe_ downcast to a derived class. Accessing members via this pointer is undefined if it is not guaranteed that the passed pointer points to an object of the _derived_ class - even if the memory layout is the same. In this case this static_cast acts like a reinterpret_cast. --- dune/istl/bvector.hh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dune/istl/bvector.hh b/dune/istl/bvector.hh index 352f4f442..cd988809b 100644 --- a/dune/istl/bvector.hh +++ b/dune/istl/bvector.hh @@ -1101,7 +1101,7 @@ namespace Dune { //! construct from base class object with reference semantics! CompressedBlockVectorWindow (const compressed_block_vector_unmanaged<B,A>& _a) { - // cast needed to access protected data (upcast) + // cast needed to access protected data (downcast) const CompressedBlockVectorWindow& a = static_cast<const CompressedBlockVectorWindow&>(_a); // make me point to the other's data -- GitLab