-
Notifications
You must be signed in to change notification settings - Fork 86
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WITH with this causes warning: implicit capture of 'this' with recent clangs #342
Comments
I am surprised that it has taken this long for anyone to report this. Yes, the implicit capture of Suggestions are very welcome. |
Would it be possible to special-case this for e.g., doctest and catch2 (I guess), if For other people encountering this and using cmake+conan, I've worked around the issue by disabling the warning for Trompeloeil and it's dependencies:
|
Maybe possible, but not easily. Catch2, and I believe doctest also, only implements tests as member functions when you use fixtures, otherwise they are freestanding functions. So the macro would have to expand to different things depending on where it is expanded. |
Looking at the metaprogramming library and constraints and concept pages on cppreference, I get a feeling there's a solution to this hiding there somewhere. :-) |
How does a C++ library writer respond to an existential threat from the C++ committee? This warning could become a hard error as soon as C++26. Nobody said breaking backward compatibility in C++ would make life easier for library writers! /rant @SimonKagstrom : I believe there is too, starting with whether Of course we remain reliant on C++ compiler maintainers to write conforming implementations, that is not to remove support for a construct for previous language dialects "by accident", but that has always been the a part of this life. /rant Sorry to be so sketchy here, I would have liked to present an implementation. I am hopeful @rollbear or yourself can see what I am talking about. |
My current thoughts are on introducing yet a new set of macros, with Naming suggestions? |
With a recent Apple clang update (
Apple clang version 16.0.0 (clang-1600.0.26.3)
) we've started getting deprecation warnings for some unit tests, related to how the trompeloeilWITH
macro is used:A short example to reproduce this with regular clang-17 (https://godbolt.org/z/x6YKzb6Gb):
As in the example, we can use
LR_WITH
to correct this. However, capturing this with[&]
seems unnecessary, so is there some trompeloeil change that should be done for this, or should we start usingLR_WITH
for these?The text was updated successfully, but these errors were encountered: