This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: RFC: New C++ Attribute: final
Alexandre Oliva <aoliva@redhat.com> writes:
| On Mar 2, 2004, Gabriel Dos Reis <gdr@integrable-solutions.net> wrote:
|
| > Alexandre Oliva <aoliva@redhat.com> writes:
|
| > | Sure, but that's besides the point. In the case at hand, the object
| > | *may* have a derived type that overrides the member function, but the
| > | other member function actually wanted the non-overridden function to
| > | be called.
|
| > Like a local class? ;-)
|
| Err... I don't think so. Consider:
|
| struct base {
| typedef /* whatever */ iterator;
| iterator begin();
| iterator end();
| virtual void f(iterator);
| };
| struct foo : base {
| void f(iterator) { do_something(); }
| void g() {
| call_func_for_each(this,
| & __extension__ __attribute__((__final__))
| foo::f,
The issue is actually type rooted. Given C++ separate compilation,
you would need a way to make the callee agree on the type of that
expression so that it expands to the "right" function, or else you get
th wrong result. Someone was worrying about safety, I don't think
this one is making us move towards that direction.
-- Gaby