[Bug c/22052] [4.0/4.1 Regression] redefinition of inline function succeeds
joseph at codesourcery dot com
gcc-bugzilla@gcc.gnu.org
Tue Jun 14 01:19:00 GMT 2005
------- Additional Comments From joseph at codesourcery dot com 2005-06-14 01:19 -------
Subject: Re: [4.0/4.1 Regression] redefinition of inline function
succeeds
On Tue, 14 Jun 2005, echristo at redhat dot com wrote:
> So, what you're saying is that we should accept this:
>
> extern inline int foo (void) { return 0; }
> inline int foo (void) { return 1; }
>
> unless we're in strict c99 mode.
A C99 conditional is pointless and possibly harmful for this case without
the rest of C99 semantics, since "inline" and "extern inline" are
(approximately) the other way round in C99 from in gnu89. (It's only
approximate; for example,
inline int foo (void) { return 1; }
on its own is an inline definition only in C99 but
inline int foo (void) { return 1; }
int foo(void);
yields an external definition in C99: any declaration of foo without
inline or with extern causes it to be exported.)
So, just accept all cases GCC has traditionally accepted here without
regard to language version for now.
> And reject this:
>
> static inline int foo (void) { return 0; }
> static inline int foo (void) { return 1; }
>
> in all cases?
Yes.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22052
More information about the Gcc-bugs
mailing list