]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
typeck.c (comp_template_parms_position): 'auto' and 'decltype(auto)' are different...
authorJason Merrill <jason@redhat.com>
Fri, 7 Mar 2014 20:00:31 +0000 (15:00 -0500)
committerJason Merrill <jason@gcc.gnu.org>
Fri, 7 Mar 2014 20:00:31 +0000 (15:00 -0500)
* typeck.c (comp_template_parms_position): 'auto' and
'decltype(auto)' are different from real template parms.

From-SVN: r208414

gcc/cp/ChangeLog
gcc/cp/typeck.c
gcc/testsuite/g++.dg/cpp0x/auto11.C

index aa8b9143a07cece49cf6acb831cc26fa181ba7ba..99a71fbbb73da9964b8155854187acb9cc1a5fa9 100644 (file)
@@ -1,5 +1,8 @@
 2014-03-07  Jason Merrill  <jason@redhat.com>
 
+       * typeck.c (comp_template_parms_position): 'auto' and
+       'decltype(auto)' are different from real template parms.
+
        * parser.c (cp_parser_using_declaration): Consume the semicolon
        after bare parameter pack error.
 
index d8374d9b0b4efb7194368abcc1e56aef7eae2198..559f19b55df30bdcd6572ec98c85e2b1339c1a95 100644 (file)
@@ -1150,6 +1150,11 @@ comp_template_parms_position (tree t1, tree t2)
          != TEMPLATE_PARM_PARAMETER_PACK (index2)))
     return false;
 
+  /* In C++14 we can end up comparing 'auto' to a normal template
+     parameter.  Don't confuse them.  */
+  if (cxx_dialect >= cxx1y && (is_auto (t1) || is_auto (t2)))
+    return TYPE_IDENTIFIER (t1) == TYPE_IDENTIFIER (t2);
+
   return true;
 }
 
index 05f5f5c20efd71a62627d60c5049d717b6aa1b79..dcdb28c04803c5e21ae83df66c6e1fd3fe8583a0 100644 (file)
@@ -8,5 +8,5 @@ template<int> struct A
 
 void foo()
 {
-  A<0>().operator auto();      // { dg-error "auto.*conversion" }
+  A<0>().operator auto();      // { dg-error "auto" }
 }