http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49003
Summary: [C++0x] decltype in member function's trailing return
type should deduce constness of *this
Product: gcc
Version: 4.7.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: [email protected]
ReportedBy: [email protected]
Now that the resolution of issue #1207
(http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#1207) made it
into the standard, the following example (taken from the same page) should
compile:
struct vector {
struct iterator { };
struct const_iterator { };
iterator begin();
const_iterator begin() const;
};
class block {
vector v;
auto end() const -> decltype(v.begin()) { return v.begin(); }
};
Currently, GCC gives the same error as before:
test.cpp: In member function ‘vector::iterator block::end() const’:
test.cpp:9:66: error: could not convert ‘((const
block*)this)->block::v.vector::begin()’ to ‘vector::iterator’