This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: gnu_inline attribute for C++
- From: Geoffrey Keating <geoffk at apple dot com>
- To: Ian Lance Taylor <iant at google dot com>
- Cc: Mark Mitchell <mark at codesourcery dot com>, Alexandre Oliva <aoliva at redhat dot com>, gcc-patches at gcc dot gnu dot org, jakub at redhat dot com
- Date: 10 Jul 2007 21:54:12 -0700
- Subject: Re: gnu_inline attribute for C++
- References: <orir9d98gq.fsf@oliva.athome.lsd.ic.unicamp.br> <46943918.9040707@codesourcery.com> <m3ps2zr54s.fsf@localhost.localdomain>
Ian Lance Taylor <iant@google.com> writes:
> Mark Mitchell <mark@codesourcery.com> writes:
>
> > Doesn't something already check that we don't have DECL_INITIAL for both
> > NEW_RESULT and OLD_RESULT? If we have DECL_INITIAL for both, that means
> > the function is defined twice, which should be an error. Or does
> > gnu_inline allow you to override the definition in the same translation
> > unit? That's a pretty nasty complication. I'm not confident that you
> > can undo the effects of DECL_INTERFACE_KNOWN and such after the fact, in
> > the way that you're trying to do.
>
> The gnu_inline attribute does permit overriding the definition in the
> same translation unit. You can see this in action in the gcc sources:
> compare the definition of floor_log2 in toplev.h and toplev.c.
The C++ language, however, doesn't permit such things, and I doubt
that the C++ frontend is expecting such things to happen.
What happens if you have a structure definition with the same name in
both functions, and it needs RTTI support?