[PATCH] D155573: [Clang] Fix the location of default init expressions

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jul 18 05:44:28 PDT 2023


aaron.ballman accepted this revision.
aaron.ballman added a comment.
This revision is now accepted and ready to land.

LGTM



================
Comment at: clang/test/SemaCXX/source_location.cpp:796
+static_assert(S(0).i == S{0}.i);
+static_assert(S(0).j == S{0}.i);
+}
----------------
cor3ntin wrote:
> tbaeder wrote:
> > aaron.ballman wrote:
> > > cor3ntin wrote:
> > > > aaron.ballman wrote:
> > > > > Shouldn't this test fail because `i != j`?
> > > > > 
> > > > > Can you add a test that demonstrates we've corrected the source location information for diagnostics?
> > > > They should all be equal!
> > > > 
> > > > > Can you add a test that demonstrates we've corrected the source location information for diagnostics?
> > > > 
> > > > Hum, i was planning to do that in https://reviews.llvm.org/D155175. I can try to think of something there!
> > > > They should all be equal!
> > > 
> > > Whaaaaa? Shouldn't `i == 790 && j == 791`?
> > IIUC, they are evaluated as part of the constructor, so the values should be 795 or 796. Maybe that can be changed to
> > ```
> > static_assert(S(0).i == S{0}.i == 796);
> > ```
> > ?
> This is https://cplusplus.github.io/CWG/issues/2631.html
Oh yeah! Thank you for the reminder, that makes sense now. A comment reminding other readers might not be a bad idea.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D155573



More information about the cfe-commits mailing list