This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c/22052] [4.0/4.1 Regression] redefinition of inline function succeeds


------- 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]