mangle.c (write_expression): Correct handling of enumeration constants.
* mangle.c (write_expression): Correct handling of enumeration constants. (write_template_arg): Likewise. * pt.c (convert_template_argument): Do not fold non-type template arguments when inside a template. * g++.dg/abi/mangle16.C: New test. * g++.dg/abi/mangle17.C: Likewise. From-SVN: r58234
This commit is contained in:
parent
2982f6ffc4
commit
d3133e688d
@ -1,5 +1,11 @@
|
||||
2002-10-16 Mark Mitchell <mark@codesourcery.com>
|
||||
|
||||
* mangle.c (write_expression): Correct handling of enumeration
|
||||
constants.
|
||||
(write_template_arg): Likewise.
|
||||
* pt.c (convert_template_argument): Do not fold non-type template
|
||||
arguments when inside a template.
|
||||
|
||||
PR c++/7478
|
||||
* cvt.c (convert_to_reference): Allow references as the incoming
|
||||
type.
|
||||
|
@ -1869,10 +1869,15 @@ write_expression (expr)
|
||||
|| code == TEMPLATE_PARM_INDEX)
|
||||
write_template_param (expr);
|
||||
/* Handle literals. */
|
||||
else if (TREE_CODE_CLASS (code) == 'c')
|
||||
else if (TREE_CODE_CLASS (code) == 'c'
|
||||
|| (abi_version_at_least (2) && code == CONST_DECL))
|
||||
write_template_arg_literal (expr);
|
||||
else if (DECL_P (expr))
|
||||
{
|
||||
/* G++ 3.2 incorrectly mangled non-type template arguments of
|
||||
enumeration type using their names. */
|
||||
if (code == CONST_DECL)
|
||||
G.need_abi_warning = 1;
|
||||
write_char ('L');
|
||||
write_mangled_name (expr);
|
||||
write_char ('E');
|
||||
@ -2105,15 +2110,20 @@ write_template_arg (node)
|
||||
else if (code == TEMPLATE_DECL)
|
||||
/* A template appearing as a template arg is a template template arg. */
|
||||
write_template_template_arg (node);
|
||||
else if ((TREE_CODE_CLASS (code) == 'c' && code != PTRMEM_CST)
|
||||
|| (abi_version_at_least (2) && code == CONST_DECL))
|
||||
write_template_arg_literal (node);
|
||||
else if (DECL_P (node))
|
||||
{
|
||||
/* G++ 3.2 incorrectly mangled non-type template arguments of
|
||||
enumeration type using their names. */
|
||||
if (code == CONST_DECL)
|
||||
G.need_abi_warning = 1;
|
||||
write_char ('L');
|
||||
write_char ('Z');
|
||||
write_encoding (node);
|
||||
write_char ('E');
|
||||
}
|
||||
else if (TREE_CODE_CLASS (code) == 'c' && code != PTRMEM_CST)
|
||||
write_template_arg_literal (node);
|
||||
else
|
||||
{
|
||||
/* Template arguments may be expressions. */
|
||||
|
@ -3487,10 +3487,11 @@ convert_template_argument (parm, arg, args, complain, i, in_decl)
|
||||
if (invalid_nontype_parm_type_p (t, complain))
|
||||
return error_mark_node;
|
||||
|
||||
if (processing_template_decl)
|
||||
if (processing_template_decl && !abi_version_at_least (2))
|
||||
arg = maybe_fold_nontype_arg (arg);
|
||||
|
||||
if (!uses_template_parms (arg) && !uses_template_parms (t))
|
||||
if ((!abi_version_at_least (2) || !processing_template_decl)
|
||||
&& (!uses_template_parms (arg) && !uses_template_parms (t)))
|
||||
/* We used to call digest_init here. However, digest_init
|
||||
will report errors, which we don't want when complain
|
||||
is zero. More importantly, digest_init will try too
|
||||
|
@ -1,5 +1,8 @@
|
||||
2002-10-16 Mark Mitchell <mark@codesourcery.com>
|
||||
|
||||
* g++.dg/abi/mangle16.C: New test.
|
||||
* g++.dg/abi/mangle17.C: Likewise.
|
||||
|
||||
PR c++/7478
|
||||
* g++.dg/template/ref1.C: New test.
|
||||
|
||||
|
14
gcc/testsuite/g++.dg/abi/mangle16.C
Normal file
14
gcc/testsuite/g++.dg/abi/mangle16.C
Normal file
@ -0,0 +1,14 @@
|
||||
// { dg-options "-fabi-version=0" }
|
||||
|
||||
enum E { e = 3 };
|
||||
|
||||
template <int I> struct S {};
|
||||
|
||||
template <int I> void f (S<e + 1>) {}
|
||||
template void f<7>(S<e + 1>);
|
||||
|
||||
template <int I> void g (S<e>) {}
|
||||
template void g<7>(S<e>);
|
||||
|
||||
// { dg-final { scan-assembler _Z1fILi7EEv1SIXplL1E3ELi1EEE } }
|
||||
// { dg-final { scan-assembler _Z1gILi7EEv1SIL1E3EE } }
|
11
gcc/testsuite/g++.dg/abi/mangle17.C
Normal file
11
gcc/testsuite/g++.dg/abi/mangle17.C
Normal file
@ -0,0 +1,11 @@
|
||||
// { dg-options "-Wabi" }
|
||||
|
||||
enum E { e = 3 };
|
||||
|
||||
template <int I> struct S {};
|
||||
|
||||
template <int I> void f (S<e + int (3.7)>) {}
|
||||
template void f<7>(S<e + int (3.7)>); // { dg-warning "mangle" }
|
||||
|
||||
template <int I> void g (S<e + int (3.7)>) {}
|
||||
template void g<7>(S<e + int (3.7)>); // { dg-warning "mangle" }
|
Loading…
Reference in New Issue
Block a user