This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

g++ 4.4.0 auto keyword


In the release notes for 4.4, it says that the auto keyword can be
used for type inference, and the c++0x page provides some links to
examples.  It looks like this should be valid:

#include<iostream>

int main() {
  auto t = 7;
  std::cout << t << std::endl;
  return 0;
}

However, when I try to compile this, I get:

g++-4.4.0 -o auto auto.cpp
auto.cpp: In function 'int main()':
auto.cpp:4: error: ISO C++ forbids declaration of 't' with no type

What am I doing wrong?  Is there some switch I need to use to enable
the c++0x functionality?

Please include my email address in any replies; I'm not on the
gcc-help list.  Thanks in advance.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]