This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/13452] No error on invalid (I think) C++ code


------- 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]