[LLVMbugs] [Bug 9519] New: clang warns about missing prototype when using friend function with inline definition
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Mon Mar 21 05:49:31 PDT 2011
http://llvm.org/bugs/show_bug.cgi?id=9519
Summary: clang warns about missing prototype when using friend
function with inline definition
Product: clang
Version: unspecified
Platform: PC
OS/Version: All
Status: NEW
Severity: normal
Priority: P
Component: C++
AssignedTo: unassignedclangbugs at nondot.org
ReportedBy: jonathan.sauer at gmx.de
CC: llvmbugs at cs.uiuc.edu, dgregor at apple.com
The following code, compiled with -Wmissing-prototypes, results in the
incorrect warning "no previous prototype for function 'do_something'":
class WithFriends {
friend void do_something() { }
};
int main(int, char**)
{
}
Output of clang:
$ /opt/bin/clang -std=c++0x -Wmissing-prototypes clangBugs.cpp
clangBugs.cpp:2:14: warning: no previous prototype for function 'do_something'
[-Wmissing-prototypes]
friend void do_something() { }
^
1 warning generated.
My clang version:
$ /opt/bin/clang --version
clang version 3.0 (trunk 127993)
Target: x86_64-apple-darwin10
Thread model: posix
I believe that this warning is incorrect, since friend functions defined
immediately are implicitely inline, and inline functions (IIRC) do not require
a prototype.
Marking the function explicitely as inline makes the warning disappear.
This change happened between SVN revision 127156 (no warning) and 127993
(warning).
--
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.
More information about the llvm-bugs
mailing list