This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
g++ 4.4.0 auto keyword
- From: tsuraan <tsuraan at gmail dot com>
- To: gcc-help at gcc dot gnu dot org
- Date: Thu, 25 Jun 2009 10:01:57 -0500
- Subject: 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.