Commit 5128e014 by Jason Merrill Committed by Jason Merrill

re PR c++/55564 (internal error using decltype of a template type parameter for…

re PR c++/55564 (internal error using decltype of a template type parameter for late-specified function result type)

	PR c++/55564
	* pt.c (unify) [ARRAY_TYPE]: Unify the element type before the bounds.

From-SVN: r194248
parent 37376165
2012-12-06 Jason Merrill <jason@redhat.com>
PR c++/55564
* pt.c (unify) [ARRAY_TYPE]: Unify the element type before the bounds.
2012-12-03 Paolo Carlini <paolo.carlini@oracle.com> 2012-12-03 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/54170 PR c++/54170
......
...@@ -16593,6 +16593,8 @@ unify (tree tparms, tree targs, tree parm, tree arg, int strict, ...@@ -16593,6 +16593,8 @@ unify (tree tparms, tree targs, tree parm, tree arg, int strict,
if ((TYPE_DOMAIN (parm) == NULL_TREE) if ((TYPE_DOMAIN (parm) == NULL_TREE)
!= (TYPE_DOMAIN (arg) == NULL_TREE)) != (TYPE_DOMAIN (arg) == NULL_TREE))
return unify_type_mismatch (explain_p, parm, arg); 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) if (TYPE_DOMAIN (parm) != NULL_TREE)
{ {
tree parm_max; tree parm_max;
...@@ -16651,8 +16653,7 @@ unify (tree tparms, tree targs, tree parm, tree arg, int strict, ...@@ -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, RECUR_AND_CHECK_FAILURE (tparms, targs, parm_max, arg_max,
UNIFY_ALLOW_INTEGER, explain_p); UNIFY_ALLOW_INTEGER, explain_p);
} }
return unify (tparms, targs, TREE_TYPE (parm), TREE_TYPE (arg), return unify_success (explain_p);
strict & UNIFY_ALLOW_MORE_CV_QUAL, explain_p);
case REAL_TYPE: case REAL_TYPE:
case COMPLEX_TYPE: case COMPLEX_TYPE:
......
// PR c++/55564
// { dg-options -std=c++11 }
template <typename T, decltype(sizeof(T)) N>
auto array_size(T(&)[N]) -> decltype(N) { return N; }
int main() {
int simple[4] = {};
int result = array_size(simple);
return result;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment