re PR c++/16240 (g++ generates incorrect mangled name)

PR c++/16240
	* mangle.c (write_template_arg): Correct mangling.

	PR c++/16240
	* g++.dg/abi/mangle22.C: New test.
	* g++.dg/abi/mangle23.C: Likewise.

From-SVN: r84033
This commit is contained in:
Mark Mitchell 2004-07-02 23:56:38 +00:00 committed by Mark Mitchell
parent 1568430fae
commit d9634d5371
5 changed files with 39 additions and 4 deletions

View File

@ -1,5 +1,8 @@
2004-07-02 Mark Mitchell <mark@codesourcery.com>
PR c++/16240
* mangle.c (write_template_arg): Correct mangling.
PR c++/16297
* decl.c (grokdeclarator): Robustify.

View File

@ -2203,12 +2203,20 @@ write_template_arg (tree node)
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)
/* Until ABI version 2, non-type template arguments of
enumeration type were mangled using their names. */
if (code == CONST_DECL && !abi_version_at_least (2))
G.need_abi_warning = 1;
write_char ('L');
write_char ('Z');
/* Until ABI version 3, the underscore before the mangled name
was incorrectly omitted. */
if (!abi_version_at_least (3))
{
G.need_abi_warning = 1;
write_char ('Z');
}
else
write_string ("_Z");
write_encoding (node);
write_char ('E');
}

View File

@ -1,3 +1,9 @@
2004-07-02 Mark Mitchell <mark@codesourcery.com>
PR c++/16240
* g++.dg/abi/mangle22.C: New test.
* g++.dg/abi/mangle23.C: Likewise.
2004-07-02 David Billinghurst (David.Billinghurst@riotinto.com)
PR fortran/16290

View File

@ -0,0 +1,9 @@
// PR c++/16240
// { dg-options "-fabi-version=3" }
void foo(char);
template<void (&)(char)> struct CB {};
void g(CB<foo> i) {}
// { dg-final { scan-assembler "\n_?_Z1g2CBIL_Z3foocEE\[: \t\n\]" } }

View File

@ -0,0 +1,9 @@
// PR c++/16240
// { dg-options "-fabi-version=2" }
void foo(char);
template<void (&)(char)> struct CB {};
void g(CB<foo> i) {}
// { dg-final { scan-assembler "\n_?_Z1g2CBILZ3foocEE\[: \t\n\]" } }