<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On Dec 19, 2009, at 12:11 AM, Eli Friedman wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div>Author: efriedma<br>Date: Sat Dec 19 02:11:05 2009<br>New Revision: 91767<br><br>URL: <a href="http://llvm.org/viewvc/llvm-project?rev=91767&view=rev">http://llvm.org/viewvc/llvm-project?rev=91767&view=rev</a><br>Log:<br>Initialization improvements: addition of string initialization and a few<br>small bug fixes in SemaInit, switch over SemaDecl to use it more often, and<br>change a bunch of diagnostics which are different with the new initialization<br>code.<br></div></blockquote><div><br></div>Cool, thanks! Comments below...</div><div><br><blockquote type="cite"><div>@@ -2492,7 +2500,8 @@<br>                                            const InitializationKind &Kind,<br>                                            Expr *Initializer,<br>                                        InitializationSequence &Sequence) {<br>-  // FIXME: Implement!<br>+  Sequence.setSequenceKind(InitializationSequence::StringInit);<br>+  Sequence.AddStringInitStep(Entity.getType().getType());<br> }<br></div></blockquote><div><br></div>We'll need to perform more of the checking from CheckStringInit here, to determine whether it is valid to initialize the entity with the given string literal. That will become important when overload resolution switches over to using InitializationSequences, because we determine the validity of the initialization in the "Try*" function and then actually perform the initialization in "Perform". </div><div><br><blockquote type="cite"><div> /// \brief Attempt initialization by constructor (C++ [dcl.init]), which<br>@@ -2711,10 +2720,17 @@<br>       }<br>     }    <br>   }<br>-  <br>+<br>+  SourceLocation DeclLoc = Initializer->getLocStart();<br>+<br>   if (const RecordType *SourceRecordType = SourceType->getAs<RecordType>()) {<br>     // The type we're converting from is a class type, enumerate its conversion<br>     // functions.<br>+<br>+    // Try to force the type to be complete before enumerating the conversion<br>+    // functions; it's okay if this fails, though.<br>+    S.RequireCompleteType(DeclLoc, SourceType, 0);<font class="Apple-style-span" color="#000000"><font class="Apple-style-span" color="#144FAE"><br></font></font></div></blockquote><div><br></div><div>This would be better as</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">     </span>if (!S.RequireCompleteType(DeclLoc, SourceType, 0)) {</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>// enumerate conversion functions</div><div><span class="Apple-tab-span" style="white-space:pre">    </span>}</div><br></div><div><span class="Apple-tab-span" style="white-space:pre">      </span>- Doug</div></body></html>