So I want to use the llvm::Twine
string chunk class.
I have the following sample:
#include <llvm/ADT/Twine.h>
#include <iostream>
int main()
{
llvm::Twine twine1 = llvm::Twine("aaaa") + "bbbb" + "cccc" + "dddd";
llvm::Twine twine2 = llvm::Twine(twine1) + "dddd" + "eeee";
std::cout << twine1.str() << std::endl;
std::cout << twine2.str() << std::endl;
return 0;
}
It runs with clang++
with -O3
and g++
with -O0
but segfault with g++
with -O3
. I tried this code parts different versions of clang library from 3.4-3.9 and tried with g++ 4.8.4
, g++ 4.8.5
and mingw-5.3.0
.
You need the llvm library and link the code with -lLLVMSupport -lLLVMCore
and the others from llvm-config --ldflags