[prev in list] [next in list] [prev in thread] [next in thread]
List: llvm-bugs
Subject: [LLVMbugs] [Bug 10231] New: no error on inline function with static
From: bugzilla-daemon () llvm ! org
Date: 2011-06-30 20:16:24
Message-ID: bug-10231-206 () http ! llvm ! org/bugs/
[Download RAW message or body]
http://llvm.org/bugs/show_bug.cgi?id=10231
Summary: no error on inline function with static variable
Product: clang
Version: trunk
Platform: PC
OS/Version: Linux
Status: NEW
Severity: normal
Priority: P
Component: -New Bugs
AssignedTo: unassignedclangbugs@nondot.org
ReportedBy: nlewycky@google.com
CC: llvmbugs@cs.uiuc.edu
C99 6.7.4 paragraph 3 reads:
"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."
which does not appear to be implemented by clang:
nlewycky@ducttape:~$ cat x.c
inline int* foo() {
static int x;
return &x;
}
nlewycky@ducttape:~$ clang x.c -std=c99 -Wall -pedantic -fsyntax-only
nlewycky@ducttape:~$
GCC notices this and offers a warning:
nlewycky@ducttape:~$ gcc x.c -std=c99 -fsyntax-only
x.c: In function ‘foo':
x.c:2: warning: ‘x' is static but declared in inline function ‘foo' which is
not static
but I really think that warning should be an error (downgrading it to a warning
is fine as an extension so long as you go ahead and detect bad uses of it, such
as taking its address).
--
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
LLVMbugs@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic