GCC doesn't produce "unused variable" warnings for 'vec' and 'str' in the code below:

  #include <vector>
  #include <string>

  int main()
  {
          std::vector<char> vec;
          std::string str;
          char c;
  }

When compiling this with either GCC 4.6.3 or 4.7.2, I only get:

  $ g++ -Wall -W main.cpp
  main.cpp: In function 'int main()':
  main.cpp:8:14: warning: unused variable 'c' [-Wunused-variable]

It catches 'c' as being unused, but not 'vec' and 'str'. Is this on purpose, or did I run across a bug?


_______________________________________________
help-gplusplus mailing list
help-gplusplus@gnu.org
https://lists.gnu.org/mailman/listinfo/help-gplusplus

Reply via email to