* mangle.c (mangle_decl_string): Mangle the names of overloaded
operators, even when they have `extern "C"' linkage.
From-SVN: r40690
+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,
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. */
--- /dev/null
+// 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();
+}