Error: "Recursive compilation" when run lli

I edit two files named test.h,test.cpp as follow:

///////////////test.h////////////////////////////////////////////////////////////////
class TestClass
{
private:
	int fTotal;
public:
	TestClass();
	~TestClass();
};
///////////test.cpp/////////////////////////////////////////////////////////////////////////////
#include "test.h"

TestClass::TestClass()
{
fTotal = 2;
}

TestClass::~TestClass()
{
fTotal = 3;
}

int main()
{
  TestClass short_name; 
  return 0;
}

and I run: clang++ -c test.cpp -emit-llvm -o test.bc
and lli test.bc, 
I get follow error:
assert(!isAlreadyCodeGenerating && "Error: Recursive compilation detected!");
How can I fix it? Thank you.
p.s I try on llvm 2.9/3.0/3.1 and they all get that error, by the way I compile llvm used VS2010 on win7.

You could put TestClass constructor and destructor function inside the
class itself.
Then it would work. But I'm not sure about the underlying reason for
that. It may have something to do with the linkage type of different
function defintions.
Hope for others' advanced explanation :slight_smile:

I edit two files named test.h,test.cpp as follow:

///////////////test.h////////////////////////////////////////////////////////////////

class TestClass
{
private:
  int fTotal;
public:
  TestClass();
  ~TestClass();

change to:
TestClass(){fTotal = 3;}
~TestClass(){fTotal = 4;}

};

///////////test.cpp/////////////////////////////////////////////////////////////////////////////

#include "test.h"

TestClass::TestClass()
{
fTotal = 2;
}

TestClass::~TestClass()
{
fTotal = 3;
}

Remove above two definitions.