This is an archive of the discontinued LLVM Phabricator instance.

[Sema] Stop stripping CV quals from *this captures in lambdas
ClosedPublic

Authored by royjacobson on Mar 15 2023, 2:17 PM.

Details

Summary

It appears we've been incorrectly stripping CV qualifiers when capturing this by value inside lambdas.
This patch simply removes the CV stripping code as discussed.

Closes https://github.com/llvm/llvm-project/issues/50866

Diff Detail

Event Timeline

royjacobson created this revision.Mar 15 2023, 2:17 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 15 2023, 2:17 PM
royjacobson requested review of this revision.Mar 15 2023, 2:17 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 15 2023, 2:17 PM
Herald added a subscriber: cfe-commits. · View Herald Transcript

rebase + release notes.

shafik added a reviewer: Restricted Project.Mar 16 2023, 8:17 AM
shafik added a subscriber: shafik.Mar 16 2023, 8:23 AM

Can you add a summary, I realize folks can goto the release notes edit and see the bug report and then go look it up but at least a cursory summary is a little more reviewer friendly.

cor3ntin accepted this revision.Mar 16 2023, 8:25 AM

LGTM. Triple checking with @hubert.reinterpretcast for conformance but I'm pretty sure that's correct.

This revision is now accepted and ready to land.Mar 16 2023, 8:25 AM

Can we also add the test from the bug report as a regression test, it looks like the existing test are basically covering the same thing but I have seen stranger bugs so it would be good to explicitly cover it.

Add the test case from the GH issue.

royjacobson edited the summary of this revision. (Show Details)Mar 18 2023, 8:33 AM
aaron.ballman accepted this revision.Mar 29 2023, 11:00 AM
aaron.ballman added a subscriber: aaron.ballman.

LGTM aside from a minor nit, though I have some minor concerns that we may silently break people's code by calling different overloads or instantiating templates differently so I wonder if this is a potentially breaking change or not. I think we can leave it out of the potentially breaking changes section unless we get some reports about a behavior change organically during this release cycle?

clang/lib/Sema/SemaExprCXX.cpp
1138

This looks like an accidental formatting mistake that can be backed out.

fix unintended indentation & rebase

royjacobson marked an inline comment as done.Mar 29 2023, 12:11 PM

LGTM aside from a minor nit, though I have some minor concerns that we may silently break people's code by calling different overloads or instantiating templates differently so I wonder if this is a potentially breaking change or not. I think we can leave it out of the potentially breaking changes section unless we get some reports about a behavior change organically during this release cycle?

My rule of thumb here is since we change behavior to match other compilers it's probably not too disruptive.

clang/lib/Sema/SemaExprCXX.cpp
1138

ah, thanks for catching it!

This revision was landed with ongoing or failed builds.Mar 29 2023, 1:12 PM
This revision was automatically updated to reflect the committed changes.
royjacobson marked an inline comment as done.