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: [email protected]
ReportedBy: [email protected]
CC: [email protected], [email protected]
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.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs