rsmith added a comment. Sorry about the redundant previous comment, the thread got forked by the change of subject and I missed the updated patch.
================ Comment at: lib/Sema/SemaDecl.cpp:10484-10485 @@ -10478,1 +10483,4 @@ + if (var->hasAttr<RequireConstantInitAttr>() && !Init) + Diag(var->getLocation(), diag::err_require_constant_init_failed); + ---------------- I think this check is incorrect: we perform constant initialization (to zero) for globals with no initializer. ================ Comment at: lib/Sema/SemaDecl.cpp:10500 @@ +10499,3 @@ + if (!*HasConstInit) + Diag(var->getLocation(), diag::warn_global_constructor) + << Init->getSourceRange(); ---------------- Instead of diagnosing the condition separately (and getting both a warning and an error for the same situation), it would seem preferable to change this to produce either `diag::warn_global_constructor` or your new error depending on whether the attribute is present. This would also remove the duplicate error messages if the attribute is specified on an object that is also marked `constexpr`. https://reviews.llvm.org/D23385 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits