<div dir="ltr">On Wed, Nov 20, 2013 at 4:31 PM, Hans Wennborg <span dir="ltr"><<a href="mailto:hans@chromium.org" target="_blank">hans@chromium.org</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im"><br>
  > I like this change, but I wonder if we can come up with a better wording<br>
  > for the diagnostic than "re-initialization". Strawman:<br>
  ><br>
  > "static data member %0 already has an initializer"<br>
<br>
</div>  Sounds good to me. New patch coming up.<br>
<div class="im"><br>
<br>
================<br>
Comment at: lib/Sema/SemaDecl.cpp:8187<br>
@@ -8186,4 +8186,3 @@<br>
</div><div class="im">     if (VDecl->isStaticDataMember() && VDecl->getAnyInitializer(PrevInit)) {<br>
-      Diag(VDecl->getLocation(), diag::err_redefinition)<br>
-        << VDecl->getDeclName();<br>
-      Diag(PrevInit->getLocation(), diag::note_previous_definition);<br>
+      Diag(Init->getExprLoc(), diag::err_static_data_member_reinitialization) << VDecl->getDeclName();<br>
+      Diag(PrevInit->getInit()->getExprLoc(), diag::note_previous_initializer) << 0;<br>
</div>----------------<br>
<div class="im">Richard Smith wrote:<br>
> You can use just `VDecl`, not `VDecl->getDeclName()`, here.<br>
</div>Hmm, when I tried this, I got:<br>
<br>
error: 'error' diagnostics seen but not expected:<br>
  File D:\src\llvm\tools\clang\test\SemaCXX\cxx1y-variable-templates_in_class.cpp Line 46: static data member 'right<type-parameter-0-0, int>' already has an initializer</blockquote><div><br></div><div>Hmm, looks like a bug in variable templates: we should be preserving the template arguments as written and using them in the declaration name here. Anyway, updated patch LGTM, thanks! </div>
</div></div></div>