GCC accepts that a function is defined several times under the same
name, provided it is static inline. It seems to rely on the assembler
to check this kind of issues.
Environment:
System: Linux nostromo 2.4.27-2-686-smp #1 SMP Tue Aug 16 15:57:25 JST 2005
i686 GNU/Linux
Architecture: i686
host: i486-pc-linux-gnu
build: i486-pc-linux-gnu
target: i486-pc-linux-gnu
configured with: ../src/configure -v
--enable-languages=c,c++,java,f95,objc,ada,treelang --prefix=/usr
--enable-shared --with-system-zlib --libexecdir=/usr/lib
--without-included-gettext --enable-threads=posix --enable-nls
--program-suffix=-4.0 --enable-__cxa_atexit --enable-libstdcxx-allocator=mt
--enable-clocale=gnu --enable-libstdcxx-debug --enable-java-gc=boehm
--enable-java-awt=gtk --enable-gtk-cairo
--with-java-home=/usr/lib/jvm/java-1.4.2-gcj-4.0-1.4.2.0/jre --enable-mpfr
--disable-werror --enable-checking=release i486-linux-gnu
How-To-Repeat:
The following compiles fine.
static inline
int
one ()
{
return 1;
}
static inline
int
one ()
{
return 2;
}
int
main ()
{
return one ();
}
------- Comment #1 from akim at lrde dot epita dot fr 2005-11-03 15:28 -------
Fix:
No idea.
--
Summary: Multiple static inline functions accepted
Product: gcc
Version: 4.0.2
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: akim at lrde dot epita dot fr
GCC build triplet: i486-pc-linux-gnu
GCC host triplet: i486-pc-linux-gnu
GCC target triplet: i486-pc-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24656