[clang] [Clang][C++23] Implement P2448R2: Relaxing some constexpr restrictions (PR #77753)

Mariya Podchishchaeva via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 6 07:17:36 PST 2024


================
@@ -2809,10 +2813,13 @@ def note_non_literal_virtual_base : Note<"%select{struct|interface|class}0 "
   "with virtual base %plural{1:class|:classes}1 is not a literal type">;
 def note_constexpr_virtual_base_here : Note<"virtual base class declared here">;
 def err_constexpr_non_literal_return : Error<
-  "%select{constexpr|consteval}0 function's return type %1 is not a literal type">;
+  "%select{constexpr|consteval}0 function with non-literal return type %1 is a C++23 extension">;
+def warn_cxx20_compat_constexpr_non_literal_return : Warning<
+  "%select{constexpr|consteval}0 function with non-literal return type %1 is incompatible with C++ standards before C++23">, InGroup<CXXPre23Compat>, DefaultIgnore;
 def err_constexpr_non_literal_param : Error<
-  "%select{constexpr|consteval}2 %select{function|constructor}1's %ordinal0 parameter type %3 is "
-  "not a literal type">;
+  "%select{constexpr|consteval}2 %select{function|constructor}1 with %ordinal0 non-literal parameter type %3 is a C++23 extension">;
+def warn_cxx20_compat_constexpr_non_literal_param : Warning<
----------------
Fznamznon wrote:

Done.

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


More information about the cfe-commits mailing list