[PATCH] D129488: [Sema] Delay evaluation of std::source_location::current() in default arguments
Aaron Ballman via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Aug 30 08:31:04 PDT 2022
aaron.ballman added a comment.
In D129488#3758449 <https://reviews.llvm.org/D129488#3758449>, @jyknight wrote:
> I'm confused about this new strategy of special-casing `source_location::current()`. Isn't it wrong to eagerly evaluate _other_ calls in default args, as well? ISTM that source_location is simply _exposing_ the bug in where we evaluate these expressions, but that it's actually a more general problem?
+1 -- special casing things by name is almost always a red flag in the frontend (we do it from time to time when trying to add compatibility hacks for broken 3rd party headers though, which is reasonable). I don't think there's supposed to be anything special about `std::source_location::current()` evaluation. Default arguments are always evaluated at the site of the call, not the callee, so eager evaluation seems like the root cause of the problem.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D129488/new/
https://reviews.llvm.org/D129488
More information about the cfe-commits
mailing list