From 10653583054e14543384a2ea432dac52ee40c337 Mon Sep 17 00:00:00 2001 From: jason Date: Thu, 6 Dec 2012 14:36:55 +0000 Subject: [PATCH] PR c++/55564 * pt.c (unify) [ARRAY_TYPE]: Unify the element type before the bounds. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@194248 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/cp/ChangeLog | 5 +++++ gcc/cp/pt.c | 5 +++-- gcc/testsuite/g++.dg/cpp0x/decltype47.C | 12 ++++++++++++ 3 files changed, 20 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/g++.dg/cpp0x/decltype47.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 220b15688ff..917f3e95a94 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2012-12-06 Jason Merrill + + PR c++/55564 + * pt.c (unify) [ARRAY_TYPE]: Unify the element type before the bounds. + 2012-12-03 Paolo Carlini PR c++/54170 diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index e349be6c4ab..27084a23598 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -16593,6 +16593,8 @@ unify (tree tparms, tree targs, tree parm, tree arg, int strict, if ((TYPE_DOMAIN (parm) == NULL_TREE) != (TYPE_DOMAIN (arg) == NULL_TREE)) return unify_type_mismatch (explain_p, parm, arg); + RECUR_AND_CHECK_FAILURE (tparms, targs, TREE_TYPE (parm), TREE_TYPE (arg), + strict & UNIFY_ALLOW_MORE_CV_QUAL, explain_p); if (TYPE_DOMAIN (parm) != NULL_TREE) { tree parm_max; @@ -16651,8 +16653,7 @@ unify (tree tparms, tree targs, tree parm, tree arg, int strict, RECUR_AND_CHECK_FAILURE (tparms, targs, parm_max, arg_max, UNIFY_ALLOW_INTEGER, explain_p); } - return unify (tparms, targs, TREE_TYPE (parm), TREE_TYPE (arg), - strict & UNIFY_ALLOW_MORE_CV_QUAL, explain_p); + return unify_success (explain_p); case REAL_TYPE: case COMPLEX_TYPE: diff --git a/gcc/testsuite/g++.dg/cpp0x/decltype47.C b/gcc/testsuite/g++.dg/cpp0x/decltype47.C new file mode 100644 index 00000000000..8e2abaa6799 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/decltype47.C @@ -0,0 +1,12 @@ +// PR c++/55564 +// { dg-options -std=c++11 } + +template +auto array_size(T(&)[N]) -> decltype(N) { return N; } + +int main() { + int simple[4] = {}; + int result = array_size(simple); + + return result; +} -- 2.11.4.GIT