diff options
author | Mark Mitchell <mark@codesourcery.com> | 2001-03-21 17:19:54 +0000 |
---|---|---|
committer | Mark Mitchell <mmitchel@gcc.gnu.org> | 2001-03-21 17:19:54 +0000 |
commit | 1c06710a55e72ca4c0aea67070b23072d8450839 (patch) | |
tree | facf5eb0702e97c6c0b246b6097b5bd834a2a0da /gcc | |
parent | 7dd4b4a326f53acd8294359ff1cdc3670e475b50 (diff) | |
download | gcc-1c06710a55e72ca4c0aea67070b23072d8450839.zip gcc-1c06710a55e72ca4c0aea67070b23072d8450839.tar.gz gcc-1c06710a55e72ca4c0aea67070b23072d8450839.tar.bz2 |
mangle.c (mangle_decl_string): Mangle the names of overloaded operators, even when they have `extern "C"' linkage.
* mangle.c (mangle_decl_string): Mangle the names of overloaded
operators, even when they have `extern "C"' linkage.
From-SVN: r40690
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/cp/mangle.c | 2 | ||||
-rw-r--r-- | gcc/testsuite/g++.old-deja/g++.other/mangle2.C | 24 |
3 files changed, 31 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 15ff7b5..3488b11 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2001-03-21 Mark Mitchell <mark@codesourcery.com> + + * mangle.c (mangle_decl_string): Mangle the names of overloaded + operators, even when they have `extern "C"' linkage. + 2001-03-19 Mark Mitchell <mark@codesourcery.com> * class.c (get_vtable_decl): Use SET_DECL_ASSEMBLER_NAME, diff --git a/gcc/cp/mangle.c b/gcc/cp/mangle.c index 4d63f76..101f412 100644 --- a/gcc/cp/mangle.c +++ b/gcc/cp/mangle.c @@ -2071,6 +2071,8 @@ mangle_decl_string (decl) write_type (TREE_TYPE (decl)); else if (/* The names of `extern "C"' functions are not mangled. */ (TREE_CODE (decl) == FUNCTION_DECL + /* But overloaded operator names *are* mangled. */ + && !DECL_OVERLOADED_OPERATOR_P (decl) /* If there's no DECL_LANG_SPECIFIC, it's a function built by language-independent code, which never builds functions with C++ linkage. */ diff --git a/gcc/testsuite/g++.old-deja/g++.other/mangle2.C b/gcc/testsuite/g++.old-deja/g++.other/mangle2.C new file mode 100644 index 0000000..25bab87 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.other/mangle2.C @@ -0,0 +1,24 @@ +// Test for overloaded operators in "C" linkage +// Build don't link: + +extern "C" { +typedef struct b +{ + int a; +} c; + +extern const c z; + +inline bool operator!=(const c& x, const c& y) +{ + return x.a != y.a; +} +}; + +void foo(); + +void bar(c x) +{ + if (x != z) + foo(); +} |