64,678
社区成员
发帖
与我相关
我的任务
分享
#include <iostream>
using namespace std;
auto ret = 3;
int main(void)
{
auto var = 3.14f;
cout << var << endl;
return 0;
}
G:\MinGW>g++ -c -o auto.o auto.cpp
auto.cpp:5:6: error: 'ret' does not name a type
auto ret = 3;
^
auto.cpp: In function 'int main()':
auto.cpp:8:10: error: 'var' does not name a type
auto var = 3.14f;
^
auto.cpp:9:10: error: 'var' was not declared in this scope
cout << var << endl;
^
GCC 4.8.1 will be C++11 feature-complete [2013-04-01]
Support for C++11 ref-qualifiers was added to the GCC 4.8 branch, making G++ the first C++ compiler to implement all the major language features of the C++11 standard. This functionality will be available in GCC 4.8.1.
diff -aurN gcc-4.8.0/gcc/c-family/c-common.c gcc-4.8.0-fixed/gcc/c-family/c-common.c
--- gcc-4.8.0/gcc/c-family/c-common.c 2013-03-08 23:54:02 -0800
+++ gcc-4.8.0-fixed/gcc/c-family/c-common.c 2013-03-31 00:01:56 -0700
@@ -238,9 +238,9 @@
int flag_use_repository;
-/* The C++ dialect being used. C++98 is the default. */
+/* The C++ dialect being used. C++11 is the default. */
-enum cxx_dialect cxx_dialect = cxx98;
+enum cxx_dialect cxx_dialect = cxx11;
/* Maximum template instantiation depth. This limit exists to limit the
time it takes to notice excessively recursive template instantiations.
diff -aurN gcc-4.8.0/gcc/c-family/c-opts.c gcc-4.8.0-fixed/gcc/c-family/c-opts.c
--- gcc-4.8.0/gcc/c-family/c-opts.c 2013-02-18 11:42:56 -0800
+++ gcc-4.8.0-fixed/gcc/c-family/c-opts.c 2013-03-31 00:01:56 -0700
@@ -210,7 +210,7 @@
unsigned int i;
struct cpp_callbacks *cb;
- parse_in = cpp_create_reader (c_dialect_cxx () ? CLK_GNUCXX: CLK_GNUC89,
+ parse_in = cpp_create_reader (c_dialect_cxx () ? CLK_GNUCXX11 : CLK_GNUC89,
ident_hash, line_table);
cb = cpp_get_callbacks (parse_in);
cb->error = c_cpp_error;