[Bug c++/49003] New: [C++0x] decltype in member function's trailing return type should deduce constness of *this
zeratul976 at hotmail dot com
gcc-bugzilla@gcc.gnu.org
Sun May 15 03:21:00 GMT 2011
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: unassigned@gcc.gnu.org
ReportedBy: zeratul976@hotmail.com
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’
More information about the Gcc-bugs
mailing list