Commit c9e90045 by Dodji Seketeli Committed by Dodji Seketeli

re PR c++/42251 (failure detecting constant integral expression)

Fix PR c++/42251

gcc/cp/ChangeLog:
	PR c++/42251
	* pt.c (convert_template_argument): Avoid missing folding of SCOPE_REFs.

gcc/testsuite/ChangeLog:
	PR c++/42251
	* g++.dg/template/const3.C: New test.

From-SVN: r155159
parent 8a8d675f
2009-12-11 Dodji Seketeli <dodji@redhat.com>
PR c++/42251
* pt.c (convert_template_argument): Avoid missing folding of SCOPE_REFs.
2009-12-10 Jakub Jelinek <jakub@redhat.com>
PR c++/42317
......
......@@ -5526,13 +5526,6 @@ convert_template_argument (tree parm,
if (TYPE_P (val))
val = strip_typedefs (val);
}
else if (TREE_CODE (orig_arg) == SCOPE_REF)
{
/* Strip typedefs from the SCOPE_REF. */
tree type = strip_typedefs (TREE_TYPE (orig_arg));
tree scope = strip_typedefs (TREE_OPERAND (orig_arg, 0));
val = build2 (SCOPE_REF, type, scope, TREE_OPERAND (orig_arg, 1));
}
else
{
tree t = tsubst (TREE_TYPE (parm), args, complain, in_decl);
......@@ -5571,6 +5564,15 @@ convert_template_argument (tree parm,
val = error_mark_node;
else if (val == error_mark_node && (complain & tf_error))
error ("could not convert template argument %qE to %qT", orig_arg, t);
if (TREE_CODE (val) == SCOPE_REF)
{
/* Strip typedefs from the SCOPE_REF. */
tree type = strip_typedefs (TREE_TYPE (val));
tree scope = strip_typedefs (TREE_OPERAND (val, 0));
val = build_qualified_name (type, scope, TREE_OPERAND (val, 1),
QUALIFIED_NAME_IS_TEMPLATE (val));
}
}
return val;
......
2009-12-11 Dodji Seketeli <dodji@redhat.com>
PR c++/42251
* g++.dg/template/const3.C: New test.
2009-12-11 Richard Guenther <rguenther@suse.de>
PR lto/42320
......
// Contributed by Dodji Seketeli <dodji@redhat.com>
// Origin PR c++/42251
// { dg-do "compile" }
struct foo
{
static const bool b = false;
};
template<bool x>
struct S1
{
};
template<bool x>
struct S2
: S1<foo::b>
{
};
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