http://llvm.org/bugs/show_bug.cgi?id=10233
Summary: extern keyword for inline definition should trigger
function emission
Product: clang
Version: trunk
Platform: PC
OS/Version: Linux
Status: NEW
Severity: normal
Priority: P
Component: -New Bugs
AssignedTo: [email protected]
ReportedBy: [email protected]
CC: [email protected]
This file:
inline double ms2kph(double ms)
{
return (ms * 3.6);
}
extern double ms2kph(double ms);
when compiled in C99 mode should produce a definition of ms2kph, but it does
not. GCC gets this right:
nlewycky@ducttape:~$ gcc -std=c99 z.c -c -o z.o
nlewycky@ducttape:~$ nm z.o
0000000000000000 T ms2kph
nlewycky@ducttape:~$ clang -std=c99 z.c -c -o z.o
nlewycky@ducttape:~$ nm z.o
nlewycky@ducttape:~$
The relevant rule in C99 6.7.4/6 is "If all of the file scope declarations for
a function in a translation unit include the inline function specifier without
extern, then the definition in that translation unit is an inline definition.
An inline definition does not provide an external definition ...".
The example in para 7/8 makes the intended behaviour much more clear.
--
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
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs