<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
</head>
<body bgcolor="#FFFFFF" text="#000000">
Consider this code:<br>
<br>
class A {<br>
public:<br>
struct I {<br>
int i = 0;<br>
};<br>
A(I i = {}) {}<br>
};<br>
<br>
With clang 3.6 this doesn't compile:<br>
<meta charset="utf-8">
4 : error: cannot use defaulted default constructor of 'I' within
'A' outside of member functions because 'i' has an initializer<br>
<br>
But if I change the code to<br>
<br>
class A {<br>
public:<br>
struct I {<br>
int i = 0;<br>
I() {}<br>
};<br>
A(I i = {}) {}<br>
};<br>
<br>
then the code compiles. Why is this so? Aren't these equivalent?<br>
<br>
Thanks,<br>
Kal<br>
</body>
</html>