aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2014-03-07 15:00:31 -0500
committerJason Merrill <jason@gcc.gnu.org>2014-03-07 15:00:31 -0500
commitd08a068b5e0d964152ee22435567c5279ada25ed (patch)
tree764677ad4ab0679b3434a88ea863af7f73bc17fd
parent941515205deb8586b79b3f02722d2d7a9532539f (diff)
downloadgcc-d08a068b5e0d964152ee22435567c5279ada25ed.zip
gcc-d08a068b5e0d964152ee22435567c5279ada25ed.tar.gz
gcc-d08a068b5e0d964152ee22435567c5279ada25ed.tar.bz2
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
-rw-r--r--gcc/cp/ChangeLog3
-rw-r--r--gcc/cp/typeck.c5
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/auto11.C2
3 files changed, 9 insertions, 1 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index aa8b914..99a71fb 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -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.
diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c
index d8374d9..559f19b5 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 05f5f5c..dcdb28c 100644
--- a/gcc/testsuite/g++.dg/cpp0x/auto11.C
+++ b/gcc/testsuite/g++.dg/cpp0x/auto11.C
@@ -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" }
}