[LLVMdev] Inclusion of iostream affects devirtualization in release_35

martin krastev
Wed, 07 Jan 2015 08:03:22 -0000

Hello,

I've stumbled upon the following behavior in branches/release_35 (as of
218689) under ubuntu 14.04 LTS amd64: whenever I include the (system-wise)
gnu iostream header, clang++ stops devirtualizing the following code:


#if BREAKAGE_ENSUES
#include <iostream>
#endif

struct Base {
virtual int foo() const = 0;
};

struct A : Base {
int a;

A(const int a)
: a(a) {
}

int foo() const {
return a;
}
};

struct B : Base {
const Base* b;

B(const Base* const base)
: b(base) {
}

int foo() const {
return b->foo();
}
};

const A a(42);
const B b(&a);

int main(int, char**) {
return b.foo();
}


Is that a known issue, and if not, under what category should I file a
ticket for it?

Best regards,
Martin
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://lists.llvm.org/pipermail/llvm-dev/attachments/20150107/d8964242/attachment.html>