<html><body><div style="color:#000; background-color:#fff; font-family:times new roman, new york, times, serif;font-size:10pt"><div><span style="font-size: 13px; ">I'm migrating a project from GCC to Clang on OS X, and meet 1 code generation difference by clang/gcc: clang doesn't generate "complete object constructor" (the C1 version) code when the class contains pure virtual method, but gcc does, (and llvm-gcc also does).</span></div><div><span style="font-size: 13px; "><br></span></div><div style="color: rgb(0, 0, 0); font-family: 'times new roman', 'new york', times, serif; background-color: transparent; font-style: normal; "><span style="font-size: 13px; ">I'm not sure whether this is a clang bug, but could anyone tell me whether clang acts properly? Is there any standard that defines whether compiler shouldn't generate C1 version construct when the class has pure virtual method?</span></div><div style="color: rgb(0, 0, 0); font-family: 'times new
 roman', 'new york', times, serif; background-color: transparent; font-style: normal; font-size: 13px; "><span style="font-size: 13px; "><br></span></div><div style="color: rgb(0, 0, 0); font-family: 'times new roman', 'new york', times, serif; background-color: transparent; font-style: normal; font-size: 13px; "><span style="font-size: 13px; ">Below is the detail information related with the issue I met:</span></div><div><span style="font-size: 13px; "><br></span></div><div style="color: rgb(0, 0, 0); font-family: 'times new roman', 'new york', times, serif; background-color: transparent; font-style: normal; "><span style="font-size: small;"><span style="white-space: pre-wrap; font-family: Verdana, sans-serif; background-color: transparent; ">[Summary] clang doesn't generate "complete object constructor" (the C1 version)</span><br></span></div><div style="color: rgb(0, 0, 0); font-family: 'times new roman', 'new york', times, serif; background-color:
 transparent; font-style: normal; "><div id="c0" class="bz_comment bz_first_comment" style="margin-bottom: 2em; font-family: Verdana, sans-serif; "><pre class="bz_comment_text" id="comment_text_0" style="white-space: pre-wrap; width: 50em; "><span style="font-size: small;">code when the class contains pure virtual method. 
<br></span></pre><pre class="bz_comment_text" id="comment_text_0" style="white-space: pre-wrap; width: 50em; "><span><div style="font-family: 'times new roman', 'new york', times, serif; white-space: normal; background-color: transparent; "><span style="font-size: small;">[Clang Version] <span style="background-color: transparent; ">Apple clang version 4.0 (tags/Apple/clang-421.0.60) (based on LLVM 3.1svn)</span></span></div><div style="font-family: 'times new roman', 'new york', times, serif; font-size: 13px; white-space: normal; background-color: transparent; color: rgb(0, 0, 0); font-style: normal; "><span style="font-size: 13px; "><span style="background-color: transparent; "><br></span></span></div>[Reproduce Steps]
1. create ABISample.cpp to include below code. class A is common class, class B
contains 1 pure virtual method.
===============================
class A
{
public:
    A();
};

class B
{
public:
    B();
    virtual void Foo() = 0;
};

A::A() {};
B::B() {};
===============================

2. compile the code with clang++/g++:
- clang++ -c ABISample.cpp -o clang.o
- g++ -c ABISample.cpp -o g++.o

3. use nm to check generated symbols:
$ nm clang.o 
00000000000000e0 s EH_frame0
0000000000000000 T __ZN1AC1Ev
00000000000000f8 S __ZN1AC1Ev.eh
0000000000000020 T __ZN1AC2Ev
0000000000000120 S __ZN1AC2Ev.eh
0000000000000030 T __ZN1BC2Ev
0000000000000148 S __ZN1BC2Ev.eh
0000000000000068 S __ZTI1B
0000000000000078 S __ZTS1B
0000000000000050 S __ZTV1B
                 U __ZTVN10__cxxabiv117__class_type_infoE
                 U ___cxa_pure_virtual

$ nm g++.o 
00000000000000a8 s EH_frame0
000000000000000a T __ZN1AC1Ev
00000000000000f0 S __ZN1AC1Ev.eh
0000000000000000 T __ZN1AC2Ev
00000000000000c0 S __ZN1AC2Ev.eh
000000000000003c T __ZN1BC1Ev
0000000000000150 S __ZN1BC1Ev.eh
0000000000000014 T __ZN1BC2Ev
0000000000000120 S __ZN1BC2Ev.eh
0000000000000090 S __ZTI1B
00000000000000a0 S __ZTS1B
0000000000000070 S __ZTV1B
                 U __ZTVN10__cxxabiv117__class_type_infoE
                 U ___cxa_pure_virtual

4. compare two symbol list, you can find class B's C1 constructor are generated
by g++ but not clang++:
000000000000003c T __ZN1BC1Ev
0000000000000150 S __ZN1BC1Ev.eh

5. If I remove "= 0" from Foo() to change it from pure virtual to virtual
method, clang will generate C1 constructor.</span></pre><div style="font-size: 16px; "><br></div></div></div></div></body></html>