-
Notifications
You must be signed in to change notification settings - Fork 15.4k
Open
Labels
clang:codegenIR generation bugs: mangling, exceptions, etc.IR generation bugs: mangling, exceptions, etc.diverges-from:edgDoes the clang frontend diverge from edg compiler on this issueDoes the clang frontend diverge from edg compiler on this issuediverges-from:gccDoes the clang frontend diverge from gcc on this issueDoes the clang frontend diverge from gcc on this issuediverges-from:msvcDoes the clang frontend diverge from msvc on this issueDoes the clang frontend diverge from msvc on this issue
Description
struct mytype {};
extern "C" {
bool operator==(const mytype & a, const mytype & b);
}
bool foo(const mytype & a)
{
return a == a;
}Clang:
_Z3fooRK6mytype:
mov rsi, rdi
jmp _ZeqRK6mytypeS1_@PLTGCC:
_Z3fooRK6mytype:
mov rsi, rdi
jmp _ZeqI don't particularly care which name is used, but you're supposed to match GCC, right? (Or is GCC the one that's wrong? I'll file this against them instead if you prefer that.)
https://godbolt.org/z/xhh7T7KGd
https://eel.is/c++draft/over.literal#6 bans extern "C" for user defined literals, and such language is absent on other operators, so I think extern "C" must be tolerated on other opeerators. But they should probably be a warning.
(Originally found in mingw headers https://godbolt.org/z/xx4EP9bxG - they forgot an extern "C++" in guiddef.h.)
Metadata
Metadata
Assignees
Labels
clang:codegenIR generation bugs: mangling, exceptions, etc.IR generation bugs: mangling, exceptions, etc.diverges-from:edgDoes the clang frontend diverge from edg compiler on this issueDoes the clang frontend diverge from edg compiler on this issuediverges-from:gccDoes the clang frontend diverge from gcc on this issueDoes the clang frontend diverge from gcc on this issuediverges-from:msvcDoes the clang frontend diverge from msvc on this issueDoes the clang frontend diverge from msvc on this issue