OSDN Git Service

PR c++/46145
authorjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 25 May 2011 19:52:02 +0000 (19:52 +0000)
committerjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 25 May 2011 19:52:02 +0000 (19:52 +0000)
* decl.c (grokdeclarator): Complain about auto typedef.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@174228 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/cp/ChangeLog
gcc/cp/decl.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/cpp0x/auto9.C

index d78f183..7493fd2 100644 (file)
@@ -1,5 +1,8 @@
 2011-05-25  Jason Merrill  <jason@redhat.com>
 
+       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
index 8000441..2b6a777 100644 (file)
@@ -9481,6 +9481,12 @@ grokdeclarator (const cp_declarator *declarator,
           memfn_quals = TYPE_UNQUALIFIED;
         }
 
+      if (type_uses_auto (type))
+       {
+         error ("typedef declared %<auto%>");
+         type = error_mark_node;
+       }
+
       if (decl_context == FIELD)
        decl = build_lang_decl (TYPE_DECL, unqualified_id, type);
       else
index 3cc818a..7e88ecc 100644 (file)
@@ -1,5 +1,7 @@
 2011-05-25  Jason Merrill  <jason@redhat.com>
 
+       * g++.dg/cpp0x/auto9.C: Add typedef test.
+
        * g++.dg/cpp0x/auto23.C: New.
        * g++.dg/cpp0x/auto9.C: Adjust.
 
index 142ef90..190bfa6 100644 (file)
@@ -119,3 +119,6 @@ H<auto> 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" }