From: Jason Merrill Date: Fri, 7 Mar 2014 20:00:31 +0000 (-0500) Subject: typeck.c (comp_template_parms_position): 'auto' and 'decltype(auto)' are different... X-Git-Tag: releases/gcc-4.9.0~534 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d08a068b5e0d964152ee22435567c5279ada25ed;p=thirdparty%2Fgcc.git typeck.c (comp_template_parms_position): 'auto' and 'decltype(auto)' are different from real template parms. * typeck.c (comp_template_parms_position): 'auto' and 'decltype(auto)' are different from real template parms. From-SVN: r208414 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index aa8b9143a07c..99a71fbbb73d 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,8 @@ 2014-03-07 Jason Merrill + * 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. diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c index d8374d9b0b4e..559f19b55df3 100644 --- a/gcc/cp/typeck.c +++ b/gcc/cp/typeck.c @@ -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; } diff --git a/gcc/testsuite/g++.dg/cpp0x/auto11.C b/gcc/testsuite/g++.dg/cpp0x/auto11.C index 05f5f5c20efd..dcdb28c04803 100644 --- a/gcc/testsuite/g++.dg/cpp0x/auto11.C +++ b/gcc/testsuite/g++.dg/cpp0x/auto11.C @@ -8,5 +8,5 @@ template struct A void foo() { - A<0>().operator auto(); // { dg-error "auto.*conversion" } + A<0>().operator auto(); // { dg-error "auto" } }