Vin*_*ddy 5 c++ compiler-construction llvm clang
#include<iostream>
#include<cstdlib>
#include<cstring>
#include<cstdio>
using namespace std;
class Book{
public:
int a;
int b;
};
int main()
{
Book b1;
b1.a = 10;
b1.b = 20;
cout<< b1.a << " " <<b1.b;
}
Run Code Online (Sandbox Code Playgroud)
当我们编译上面的代码时
clang++ test.cc -o a.exe
Run Code Online (Sandbox Code Playgroud)
并运行一个完美的程序.但是当我们编译同一个程序时
clang++ test.cc -emit-llvm -S -o a.exe
Run Code Online (Sandbox Code Playgroud)
现在当我们运行它时,程序会因启动而疯狂ntvdm.exe(可以在进程资源管理器中看到)并且命令提示符开始表现得很奇怪.
软件堆栈:
clang version 2.9 (tags/RELEASE_29/final)
Target: i386-pc-mingw32
Thread model: posix
Run Code Online (Sandbox Code Playgroud)