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/11377] fault or warn modifiable static in extern inline definition


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


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