[LLVMbugs] [Bug 10168] New: -Wunused gives multiple errors for unused variable in template
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Tue Jun 21 16:01:55 PDT 2011
http://llvm.org/bugs/show_bug.cgi?id=10168
Summary: -Wunused gives multiple errors for unused variable in
template
Product: clang
Version: unspecified
Platform: PC
OS/Version: Linux
Status: NEW
Severity: normal
Priority: P
Component: C++
AssignedTo: unassignedclangbugs at nondot.org
ReportedBy: richard-llvm at metafoo.co.uk
CC: llvmbugs at cs.uiuc.edu, dgregor at apple.com
template<typename T>
struct S {
void f() {
int a;
}
};
int main() {
S<int>().f();
S<double>().f();
}
tmp.cpp:4:9: warning: unused variable 'a' [-Wunused-variable]
int a;
^
tmp.cpp:4:9: warning: unused variable 'a' [-Wunused-variable]
tmp.cpp:9:12: note: in instantiation of member function 'S<int>::f' requested
here
S<int>().f();
^
tmp.cpp:4:9: warning: unused variable 'a' [-Wunused-variable]
int a;
^
tmp.cpp:10:15: note: in instantiation of member function 'S<double>::f'
requested here
S<double>().f();
^
One warning is produced for the template definition, and one more is produced
for each instantiation. Strangely, we don't get the first warning for a
dependently-typed unused variable.
--
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