http://llvm.org/bugs/show_bug.cgi?id=8355
Summary: clang++ generates incorrect code if multiple classes
with the same name are defined in the same function
Product: clang
Version: 2.8
Platform: PC
OS/Version: Linux
Status: NEW
Severity: normal
Priority: P
Component: C++
AssignedTo: [email protected]
ReportedBy: [email protected]
CC: [email protected], [email protected]
clang++ generates incorrect code if two classes are defined with the same name
within a function. Specifically, the constructors for both classes use the
first class's vtable.
Consider the following code:
#include <iostream>
struct I
{
virtual void F() const = 0;
};
void Go(const I &i)
{
i.F();
}
int main()
{
if (true)
{
struct C : I
{
void F() const { std::cout << "A" << std::endl; }
};
Go(C());
}
if (true)
{
struct C : I
{
void F() const { std::cout << "B" << std::endl; }
};
Go(C());
}
}
Under g++ and other compilers, this prints:
A
B
Under clang++, it prints:
A
A
--
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.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs