rsmith added inline comments. ================ Comment at: lib/Sema/SemaDecl.cpp:10519-10520 @@ +10518,4 @@ + auto *CE = dyn_cast<CXXConstructExpr>(Init); + bool DiagErr = (var->isInitKnownICE() || (CE && CE->getConstructor()->isConstexpr())) + ? !var->checkInitIsICE() : !checkConstInit(); + if (DiagErr) ---------------- EricWF wrote: > rsmith wrote: > > In C++11 onwards, `checkInitIsICE` is the right thing to use in all cases. > > In C++98, `checkInitIsICE` is appropriate for globals of integral type; we > > do not have an implementation of strict constant expression checking for > > other types. Perhaps just documenting that (and maybe adding a FIXME here) > > is the best you can do for now, assuming you're not interested in > > implementing the C++98 rules. > SGTM. I think I'll fall back to `isConstantInitializer()` in C++03. Do you > have an example of what `checkConstantInitializer()` gets wrong in C++03? struct A { ~A(); int n; } a; int *p = &a.n; // constant initializer, but not a C++98 address constant expression
https://reviews.llvm.org/D23385 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits