[Bug c++/41134] [4.5 regression] Variable flagged unused if only used in template function

pinskia at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Thu Aug 20 20:50:00 GMT 2009



------- Comment #3 from pinskia at gcc dot gnu dot org  2009-08-20 20:49 -------
You cannot use a static variable in a template :).
Note the following is valid though:
namespace { int i; }
template <typename> int f() { return i; }

And still invokes the warning:
t4.cc:1:17: warning: '<unnamed>::i' defined but not used


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41134



More information about the Gcc-bugs mailing list