Defect Report 1207

I do not understand the reason for this defect report 1207 , more specifically with regard to the following sentence (emphasis mine):

Since the conversion of a member name to access a member of the class expression (9.3.1 [class.mfct.non-static] paragraph 3) occurs only inside the body of a non-static member function, the type v in trailing-return-type is not constant , but is constant in the return expression, leading to a type mismatch between the return expression and the return type of the function.

Edit

That is, I do not understand why the type v in the return type is returned non-constant.

+4
source share
2
vector v;
auto end() const -> decltype(v.begin()) { return v.begin(); }

decltype(v.begin()) trailing-return-type iterator - v vector, .

- - end(). v - this->v - , , this.

this 'pointee is const (- -), this - block const*.

, this->v - vector const (- const), v.begin() - (this->v).begin() - const -overload, const_iterator. , v.begin() trailing-return-type "" , iterator.

.

+9

, return, v v.begin().., v end() , , end() (, , v) const.

+6

All Articles