[PATCH] D38483: [ExprConstant] Allow constexpr ctor to modify non static data members in body

2017-10-03 Thread Phabricator via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rL314865: [ExprConstant] Allow constexpr ctor to modify non static data members (authored by epilk). Changed prior to commit: https://reviews.llvm.org/D38483?vs=117529&id=117605#toc Repository: rL LLVM

[PATCH] D38483: [ExprConstant] Allow constexpr ctor to modify non static data members in body

2017-10-03 Thread Richard Smith - zygoloid via Phabricator via cfe-commits
rsmith accepted this revision. rsmith added a comment. This revision is now accepted and ready to land. LGTM, thank you! Comment at: lib/AST/ExprConstant.cpp:3127 // During the construction of an object, it is not yet 'const'. // FIXME: We don't set up EvaluatingDecl for

[PATCH] D38483: [ExprConstant] Allow constexpr ctor to modify non static data members in body

2017-10-03 Thread Erik Pilkington via Phabricator via cfe-commits
erik.pilkington added inline comments. Comment at: lib/AST/ExprConstant.cpp:588 + : EI(EI), Object(Object) { +DidInsert = EI.EvaluatingConstructors.insert(Object).second; + } rsmith wrote: > Can the `DidInsert == false` case actually happen?

[PATCH] D38483: [ExprConstant] Allow constexpr ctor to modify non static data members in body

2017-10-03 Thread Erik Pilkington via Phabricator via cfe-commits
erik.pilkington updated this revision to Diff 117529. erik.pilkington marked 2 inline comments as done. erik.pilkington added a comment. Thanks for the feedback, in this new patch: - insert EvaluatingDecl into EvaluatingConstructors instead of checking it in isEvaluatingDecl() - Add a comment to

[PATCH] D38483: [ExprConstant] Allow constexpr ctor to modify non static data members in body

2017-10-02 Thread Richard Smith - zygoloid via Phabricator via cfe-commits
rsmith added inline comments. Comment at: lib/AST/ExprConstant.cpp:576 +typedef std::pair EvaluatingObject; + Please add a comment explaining what the two fields mean. Comment at: lib/AST/ExprConstant.cpp:588 + : EI(EI), Object(O

[PATCH] D38483: [ExprConstant] Allow constexpr ctor to modify non static data members in body

2017-10-02 Thread Erik Pilkington via Phabricator via cfe-commits
erik.pilkington created this revision. Previously, clang rejected the following (copied from PR19741): struct A { int a = 0; constexpr A() { a = 1; } }; constexpr bool f() { constexpr A a; static_assert(a.a == 1, ""); return a.a == 1; } static_assert(f(), ""); Clang