[Bug c++/13452] No error on invalid (I think) C++ code
Rainer dot Bensch at rsd dot rohde-schwarz dot com
gcc-bugzilla@gcc.gnu.org
Mon Jan 12 16:11:00 GMT 2004
------- Additional Comments From Rainer dot Bensch at rsd dot rohde-schwarz dot com 2004-01-12 16:10 -------
(In reply to comment #0)
> However, it now seems to me that there should be an error on the trailing
const.
No.
> Otherwise, I have no idea what the trailing const means. It appears that
> generating a const method (i.e., a method for which `this' is a pointer to
> const) requires
> class C { public: template<typename i> int (*f() const)(); };
> This may be a misunderstanding on my part, but at least some people share my
> misunderstanding; see PR c++/13447.
You declared a non const member function f() which returns a pointer to a const
member function. If the const is inside the parenteses, you declare a const
member function f() which returns a pointer to a non const member function.
Now, consider to place const at both...
Cheers, Rainer
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13452
More information about the Gcc-bugs
mailing list