From: Jason Merrill Date: Wed, 25 May 2011 19:52:02 +0000 (-0400) Subject: re PR c++/46005 ([C++0x] Don't allow "auto" as the simple-type-specifier of a typedef) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=df23ba642d9f527ee32ed7342dd049de2461aaf0;p=gcc.git re PR c++/46005 ([C++0x] Don't allow "auto" as the simple-type-specifier of a typedef) PR c++/46145 * decl.c (grokdeclarator): Complain about auto typedef. From-SVN: r174228 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index d78f18324ed..7493fd2f512 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,8 @@ 2011-05-25 Jason Merrill + PR c++/46145 + * decl.c (grokdeclarator): Complain about auto typedef. + PR c++/46245 * decl.c (grokdeclarator): Complain later for auto parameter. * pt.c (splice_late_return_type): Handle use in a template diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 8000441d06f..2b6a7770e2d 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -9481,6 +9481,12 @@ grokdeclarator (const cp_declarator *declarator, memfn_quals = TYPE_UNQUALIFIED; } + if (type_uses_auto (type)) + { + error ("typedef declared %"); + type = error_mark_node; + } + if (decl_context == FIELD) decl = build_lang_decl (TYPE_DECL, unqualified_id, type); else diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 3cc818adc80..7e88ecc8b5f 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,7 @@ 2011-05-25 Jason Merrill + * g++.dg/cpp0x/auto9.C: Add typedef test. + * g++.dg/cpp0x/auto23.C: New. * g++.dg/cpp0x/auto9.C: Adjust. diff --git a/gcc/testsuite/g++.dg/cpp0x/auto9.C b/gcc/testsuite/g++.dg/cpp0x/auto9.C index 142ef904f2d..190bfa6e8f0 100644 --- a/gcc/testsuite/g++.dg/cpp0x/auto9.C +++ b/gcc/testsuite/g++.dg/cpp0x/auto9.C @@ -119,3 +119,6 @@ H h; // { dg-error "invalid" } void qq (auto); // { dg-error "auto" } void qr (auto*); // { dg-error "auto" } + +// PR c++/46145 +typedef auto autot; // { dg-error "auto" }