AW: g++ 4.4.0 auto keyword

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



-std=gnu++0x
 

-----Ursprüngliche Nachricht-----
Von: gcc-help-owner@xxxxxxxxxxx [mailto:gcc-help-owner@xxxxxxxxxxx] Im Auftrag von tsuraan
Gesendet: Donnerstag, 25. Juni 2009 17:02
An: gcc-help@xxxxxxxxxxx
Betreff: 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 of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux