llvm-project
llvm-project copied to clipboard
Incorrect warning "unused function ..."
| Bugzilla Link | 14234 |
| Resolution | INVALID |
| Resolved on | Nov 01, 2012 04:18 |
| Version | trunk |
| OS | All |
| CC | @DougGregor,@zygoloid |
Extended Description
Compile following c++ source code with command line
$clang++ -fsyntax-only -Wall t3.cpp
namespace {
int foo(){ return 1; }
}
Clang gives unexpected warning
t3.cpp:3:5: warning: unused function 'foo' [-Wunused-function] int foo(){ ^
I think this was a misunderstanding of unnamed namespaces. Works as intended.
Why is that unexpected? 'foo' is not used in this translation unit, and cannot be accessed from outside it.