This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/11377] fault or warn modifiable static in extern inline definition
- From: "hozelda at yahoo dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 7 Aug 2004 00:18:16 -0000
- Subject: [Bug c/11377] fault or warn modifiable static in extern inline definition
- References: <20030630102552.11377.algrant@myrealbox.com>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From hozelda at yahoo dot com 2004-08-07 00:18 -------
[6.7.4#3] An inline definition of a function with external
linkage shall not contain a definition of a modifiable
object with static storage duration, and shall not contain a
reference to an identifier with internal linkage.
The following is an excerpt from bug report 16622:
**
File 5
//the following 3 function definitions would all violate 6.7.4#3
// inline void f1_bad() {static a;} //violates part a
static x1;
// inline void f2_bad() {extern x1;} //violates part b
// inline void f3_bad() {x1 = 0;} //violates part b
//but the following are OK
extern inline void f() {static a; extern x1; x1=0;} //not inline def
static inline void g() {static a; extern x1; x1=0;} //not external linkage
static [void] h(void);
static inline [void] h() {static a; extern x1; x1=0;} //neither i.d. nor e.l.
**
//comment: [void] is where 'void' should have gone in original 16622#4 message but didn't (a typo/omission).
There are other 'void' accidently missing from earlier parts of the original (not shown in above quote).
[The 'g' example under section 2 (and also the last paragraph under section 2) may be of interest here, but I
won't quote it.]
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11377