[clang] [Clang] Set `__cpp_explicit_this_parameter` (PR #107451)

via cfe-commits cfe-commits at lists.llvm.org
Thu Sep 5 12:05:52 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang

Author: cor3ntin (cor3ntin)

<details>
<summary>Changes</summary>

There are not a lot of outstanding known issues
with deducing this (besides #<!-- -->95112), so it
seems reasonable to claim full support.

Fixes #<!-- -->82780

---
Full diff: https://github.com/llvm/llvm-project/pull/107451.diff


3 Files Affected:

- (modified) clang/docs/ReleaseNotes.rst (+1) 
- (modified) clang/lib/Frontend/InitPreprocessor.cpp (+1) 
- (modified) clang/test/Lexer/cxx-features.cpp (+1-1) 


``````````diff
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
 

``````````

</details>


https://github.com/llvm/llvm-project/pull/107451


More information about the cfe-commits mailing list