Commit d9634d53 by Mark Mitchell Committed by Mark Mitchell

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
parent 1568430f
2004-07-02 Mark Mitchell <mark@codesourcery.com> 2004-07-02 Mark Mitchell <mark@codesourcery.com>
PR c++/16240
* mangle.c (write_template_arg): Correct mangling.
PR c++/16297 PR c++/16297
* decl.c (grokdeclarator): Robustify. * decl.c (grokdeclarator): Robustify.
......
...@@ -2203,12 +2203,20 @@ write_template_arg (tree node) ...@@ -2203,12 +2203,20 @@ write_template_arg (tree node)
write_template_arg_literal (node); write_template_arg_literal (node);
else if (DECL_P (node)) else if (DECL_P (node))
{ {
/* G++ 3.2 incorrectly mangled non-type template arguments of /* Until ABI version 2, non-type template arguments of
enumeration type using their names. */ enumeration type were mangled using their names. */
if (code == CONST_DECL) if (code == CONST_DECL && !abi_version_at_least (2))
G.need_abi_warning = 1; G.need_abi_warning = 1;
write_char ('L'); 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_encoding (node);
write_char ('E'); write_char ('E');
} }
......
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) 2004-07-02 David Billinghurst (David.Billinghurst@riotinto.com)
PR fortran/16290 PR fortran/16290
......
// 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\]" } }
// 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\]" } }
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