This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/13452] No error on invalid (I think) C++ code
- From: "Rainer dot Bensch at rsd dot rohde-schwarz dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 12 Jan 2004 16:10:58 -0000
- Subject: [Bug c++/13452] No error on invalid (I think) C++ code
- References: <20031219185750.13452.ian@airs.com>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- 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