[LLVMbugs] [Bug 17829] New: Functions declared extern "C" with a name matching a mangled C++ function are allowed
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Tue Nov 5 20:09:14 PST 2013
http://llvm.org/bugs/show_bug.cgi?id=17829
Bug ID: 17829
Summary: Functions declared extern "C" with a name matching a
mangled C++ function are allowed
Product: clang
Version: unspecified
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: C++
Assignee: unassignedclangbugs at nondot.org
Reporter: bugs at lovikos.net
CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
Classification: Unclassified
Created attachment 11493
--> http://llvm.org/bugs/attachment.cgi?id=11493&action=edit
Error message from failed assert
If a C function is declared that has a name that matches a mangled name of a
C++ function, the first to be declared is used. Instead it should fail to build
as the symbol is already defined. In g++ this will fail to build.
The following will compile and print "Bug":
#include <cstdio>
extern "C"{
void _Z3foov()
{
printf("Bug\n");
}
}
void foo()
{
printf("Correct\n");
}
int main()
{
foo();
}
When this code is compiled with a debug build of clang, the an assertion fails
with the attached message (files asked for at the end of the error message are
also included).
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20131106/f98171a7/attachment.html>
More information about the llvm-bugs
mailing list