[PATCH] Better diagnostic for re-initialization of static data members
Richard Smith
richard at metafoo.co.uk
Wed Nov 20 16:08:57 PST 2013
================
Comment at: lib/Sema/SemaDecl.cpp:8187
@@ -8186,4 +8186,3 @@
if (VDecl->isStaticDataMember() && VDecl->getAnyInitializer(PrevInit)) {
- Diag(VDecl->getLocation(), diag::err_redefinition)
- << VDecl->getDeclName();
- Diag(PrevInit->getLocation(), diag::note_previous_definition);
+ Diag(Init->getExprLoc(), diag::err_static_data_member_reinitialization) << VDecl->getDeclName();
+ Diag(PrevInit->getInit()->getExprLoc(), diag::note_previous_initializer) << 0;
----------------
You can use just `VDecl`, not `VDecl->getDeclName()`, here.
http://llvm-reviews.chandlerc.com/D2235
More information about the cfe-commits
mailing list