kframework/c-semantics

Aggregate initialization bug

h0nzZik opened this issue · 0 comments

The following code does not compile:

extern "C" int puts(char const *);
struct A {
	/*explicit*/ A(int){}
	~A(){puts("~A()");}
};

int t() {
	throw 5;
}

struct B {
	//A a{{1}};
	A a{1};
	int x = t();
};

int main() {
	try {
		//B b{{1}};	// fails in listInit
		B b{1}; // fails in figureInit
		//B b;
	} catch(...) {

	}
}