[PATCH] D88295: [Sema] Fix volatile check when test if a return object can be implicitly move

Arthur O'Dwyer via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Sep 25 05:53:33 PDT 2020


Quuxplusone added a comment.

(This patch was split out from D88220 <https://reviews.llvm.org/D88220> at my request.)

@nullptr.cpp, please add the regression test from https://godbolt.org/z/5EfK99 .  After a test is added, this patch LGTM (but will need approval also from someone else).

Your summary makes it sound as if Clang's [current/old] behavior is correct in C++14 and C++17; but I think it is wrong in any version. I don't see anything in CWG1579 <http://cwg-issue-browser.herokuapp.com/cwg1579> that affects volatile, and I see the same phrase "in a return statement in a function with a class return type, when the expression is the name of a non-volatile automatic object..." in both N3337 (C++11) and N4140 (C++14).  So, I think your summary is confusing/wrong, but I think your //code patch// is absolutely correct: the volatile check should be moved up unconditionally, as you have done.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D88295/new/

https://reviews.llvm.org/D88295



More information about the cfe-commits mailing list