This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/22052] [4.0/4.1 Regression] redefinition of inline function succeeds
- From: "echristo at redhat dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 17 Jun 2005 20:21:46 -0000
- Subject: [Bug c/22052] [4.0/4.1 Regression] redefinition of inline function succeeds
- References: <20050613190209.22052.echristo@redhat.com>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From echristo at redhat dot com 2005-06-17 20:21 -------
Here are the 4 testcases that I've been using to test, the first two you've
seen. (and no, the dg stuff isn't done yet, but that's merely to make the
testsuite happy.)
test1:
/* { dg-do compile } */
/* This test is expected to fail with an error for the redefinition of foo.
This violates the constraint of 6.9#3 (no more than one external definition
of an identifier with internal linkage in the same translation unit). */
static inline int foo(void) { return 1; }
static inline int foo(void) { return 0; } /* { dg-error "" } */
test2:
/* { dg-do compile } */
/* This test should compile successfully. */
extern inline int foo(void) { return 0; }
inline int foo (void) { return 1; }
test3:
/* { dg-do compile } */
/* This testcase should fail since we're redefining foo in the same
translation unit. */
extern inline int foo(void) { return 0; }
inline int foo (void) { return 1; }
int foo (void) { return 2; } /* { dg-error "error: redefinition of 'foo'" } */
test4:
/* { dg-do compile } */
/* This testcase should fail since we're redefining foo in the same
translation unit. */
int foo (void) { return 2; }
extern inline int foo (void) { return 1; }
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22052