[Clang] Set __cpp_explicit_this_parameter#107451
Merged
Merged
Conversation
There are not a lot of outstanding known issues with deducing this (besides llvm#95112), so it seems reasonable to claim full support. Fixes llvm#82780
Member
|
@llvm/pr-subscribers-clang Author: cor3ntin (cor3ntin) ChangesThere are not a lot of outstanding known issues Fixes #82780 Full diff: https://github.com/llvm/llvm-project/pull/107451.diff 3 Files Affected:
diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
index ab3c3e6049f602..d57fef62b4bcfd 100644
--- a/clang/docs/ReleaseNotes.rst
+++ b/clang/docs/ReleaseNotes.rst
@@ -365,6 +365,7 @@ Bug Fixes to C++ Support
- Fixed a bug in the substitution of empty pack indexing types. (#GH105903)
- Clang no longer tries to capture non-odr used default arguments of template parameters of generic lambdas (#GH107048)
- Fixed a bug where defaulted comparison operators would remove ``const`` from base classes. (#GH102588)
+- ``__cpp_explicit_this_parameter`` is now defined. (#GH82780)
Bug Fixes to AST Handling
diff --git a/clang/lib/Frontend/InitPreprocessor.cpp b/clang/lib/Frontend/InitPreprocessor.cpp
index 61260a3379828d..c0460889086d94 100644
--- a/clang/lib/Frontend/InitPreprocessor.cpp
+++ b/clang/lib/Frontend/InitPreprocessor.cpp
@@ -753,6 +753,7 @@ static void InitializeCPlusPlusFeatureTestMacros(const LangOptions &LangOpts,
Builder.defineMacro("__cpp_if_consteval", "202106L");
Builder.defineMacro("__cpp_multidimensional_subscript", "202211L");
Builder.defineMacro("__cpp_auto_cast", "202110L");
+ Builder.defineMacro("__cpp_explicit_this_parameter", "202110L");
}
// We provide those C++23 features as extensions in earlier language modes, so
diff --git a/clang/test/Lexer/cxx-features.cpp b/clang/test/Lexer/cxx-features.cpp
index 4a06d29ae9dbc6..34a9d56c581fcd 100644
--- a/clang/test/Lexer/cxx-features.cpp
+++ b/clang/test/Lexer/cxx-features.cpp
@@ -81,7 +81,7 @@
#error "wrong value for __cpp_named_character_escapes"
#endif
-#if check(explicit_this_parameter, 0, 0, 0, 0, 0, 0, 0)
+#if check(explicit_this_parameter, 0, 0, 0, 0, 0, 202110L, 202110L)
#error "wrong value for __cpp_explicit_this_parameter"
#endif
|
Contributor
|
It appears that #95112 is actually pretty close... are we better off holding off on this until after that goes in? |
Contributor
Author
|
There is no urgency. I made the pr so we don't forget (I certainly had...) |
cor3ntin
added a commit
that referenced
this pull request
Dec 18, 2024
This is a rebase of #95112 with my own feedback apply as @MitalAshok has been inactive for a while. It's fairly important this makes clang 20 as it is a blocker for #107451 --- [CWG2813](https://cplusplus.github.io/CWG/issues/2813.html) prvalue.member_fn(expression-list) now will not materialize a temporary for prvalue if member_fn is an explicit object member function, and prvalue will bind directly to the object parameter. The E1 in E1.static_member is now a discarded-value expression, so if E1 was a call to a [[nodiscard]] function, there will now be a warning. This also affects C++98 with [[gnu::warn_unused_result]] functions. This should not affect C where TemporaryMaterializationConversion is a no-op. Closes #100314 Fixes #100341 --------- Co-authored-by: Mital Ashok <mital@mitalashok.co.uk>
Contributor
Author
|
@erichkeane ping |
erichkeane
approved these changes
Dec 18, 2024
| - Extend lifetime of temporaries in mem-default-init for P2718R0. Clang now fully | ||
| supports `P2718R0 Lifetime extension in range-based for loops <https://wg21.link/P2718R0>`_. | ||
|
|
||
| - ``__cpp_explicit_this_parameter`` is now defined. (#GH82780) |
Contributor
There was a problem hiding this comment.
As a nit, "is now defined to the value specified in the C++X specification."
perhaps?
searlmc1
pushed a commit
to ROCm/llvm-project
that referenced
this pull request
Dec 18, 2024
…0223) This is a rebase of llvm#95112 with my own feedback apply as @MitalAshok has been inactive for a while. It's fairly important this makes clang 20 as it is a blocker for llvm#107451 Change-Id: I2261810f7c8d7dd8b3e3412c0814a528d7c7b91c --- [CWG2813](https://cplusplus.github.io/CWG/issues/2813.html) prvalue.member_fn(expression-list) now will not materialize a temporary for prvalue if member_fn is an explicit object member function, and prvalue will bind directly to the object parameter. The E1 in E1.static_member is now a discarded-value expression, so if E1 was a call to a [[nodiscard]] function, there will now be a warning. This also affects C++98 with [[gnu::warn_unused_result]] functions. This should not affect C where TemporaryMaterializationConversion is a no-op. Closes llvm#100314 Fixes llvm#100341 --------- Co-authored-by: Mital Ashok <mital@mitalashok.co.uk> (cherry picked from commit db93ef1) Change-Id: Ic277d16bc8611b9d383cb890da3eda0ef1646555
H-G-Hristov
added a commit
to H-G-Hristov/llvm-project
that referenced
this pull request
Feb 13, 2025
…TER macro `__cpp_explicit_this_parameter` has been set in LLVM20 // llvm#107451
github-actions Bot
pushed a commit
to arm/arm-toolchain
that referenced
this pull request
Feb 14, 2025
…THIS_PARAMETER macro (#127070) `__cpp_explicit_this_parameter` has been set in LLVM20 llvm/llvm-project#107451 / llvm/llvm-project@72e58e0 --------- Co-authored-by: Hristo Hristov <zingam@outlook.com>
joaosaffran
pushed a commit
to joaosaffran/llvm-project
that referenced
this pull request
Feb 14, 2025
…TER macro (llvm#127070) `__cpp_explicit_this_parameter` has been set in LLVM20 llvm#107451 / llvm@72e58e0 --------- Co-authored-by: Hristo Hristov <zingam@outlook.com>
sivan-shani
pushed a commit
to sivan-shani/llvm-project
that referenced
this pull request
Feb 24, 2025
…TER macro (llvm#127070) `__cpp_explicit_this_parameter` has been set in LLVM20 llvm#107451 / llvm@72e58e0 --------- Co-authored-by: Hristo Hristov <zingam@outlook.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
There are not a lot of outstanding known issues
with deducing this (besides #95112), so it
seems reasonable to claim full support.
Fixes #82780