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
This commit is contained in:
parent
8a8d675f41
commit
c9e900454a
@ -1,3 +1,8 @@
|
||||
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
|
||||
|
16
gcc/cp/pt.c
16
gcc/cp/pt.c
@ -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;
|
||||
|
@ -1,3 +1,8 @@
|
||||
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
|
||||
|
20
gcc/testsuite/g++.dg/template/const3.C
Normal file
20
gcc/testsuite/g++.dg/template/const3.C
Normal file
@ -0,0 +1,20 @@
|
||||
// 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>
|
||||
{
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user