[LLVMbugs] [Bug 12183] New: Assertion failure: "Functions without a prototype cannot be overloaded"
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Sun Mar 4 19:39:59 PST 2012
http://llvm.org/bugs/show_bug.cgi?id=12183
Bug #: 12183
Summary: Assertion failure: "Functions without a prototype
cannot be overloaded"
Product: clang
Version: trunk
Platform: PC
OS/Version: Linux
Status: NEW
Severity: normal
Priority: P
Component: Frontend
AssignedTo: unassignedclangbugs at nondot.org
ReportedBy: clint at clintcaywood.com
CC: llvmbugs at cs.uiuc.edu
Classification: Unclassified
Created attachment 8142
--> http://llvm.org/bugs/attachment.cgi?id=8142
10 line file that will crash clang
Trunk revision 152011.
In release mode this causes a segmentation fault, but we get the assertion
failure if those are enabled:
This example code shouldn't compile, but the compiler crashing on it is a bit
dramatic. I believe it it has something to do with clang implicitly building
overloads for function used_before_declared because it is first used with a
known type, then with an undefined type. This sets it up to be in a bad state
next time it is referenced.
If we switch the positions of foo and used_before_declared, everything is fine.
Likewise if we use a defined type for its parameter.
======================
int foo()
{
return used_before_declared(0);
}
int used_before_declared(undefined_type err)
{
}
void bar()
{
used_before_declared(0); // Will crash here
}
--
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
More information about the llvm-bugs
mailing list