<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">Am 17.04.15 um 01:48 schrieb Richard
Smith:<br>
</div>
<blockquote
cite="mid:CAOfiQq=pRvbBj=EyR0MgHOKHFPZD8cKzBgxTOVhrcQd1Y-TvdA@mail.gmail.com"
type="cite">
<div dir="ltr">
<div class="gmail_extra">
<div class="gmail_quote">On Thu, Apr 16, 2015 at 10:16 AM, Kal
<span dir="ltr"><<a moz-do-not-send="true"
href="mailto:b17c0de@gmail.com" target="_blank">b17c0de@gmail.com</a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">
<div 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>
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?</div>
</blockquote>
<div><br>
</div>
<div>They're not equivalent. The implicit constructor for
A::I also has a deduced exception specification, and
computing that exception specification requires the
initializer for 'A::i' to have already been parsed.</div>
</div>
</div>
</div>
</blockquote>
You mean initializer for 'A::I' to have already been parsed? But
hasn't the entire class definition for A::I and its initializers
already been parsed before A::A?<br>
</body>
</html>