[clang] [Clang][Sema] Reject template arguments not equivalent to their copies (part of P2308R1) (PR #193754)

Yanzuo Liu via cfe-commits cfe-commits at lists.llvm.org
Sat Apr 25 21:23:58 PDT 2026


================
@@ -7130,6 +7130,72 @@ static bool CheckTemplateArgumentPointerToMember(
   return true;
 }
 
+// P2308R1  C++26 [temp.arg.nontype]p4:
+//   ... If, for the initialization from any candidate initializer,
+//     - ...
+//     - the initialization would cause P to not be
+//       template-argument-equivalent ([temp.type]) to v,
+//   the program is ill-formed.
+// TODO: Cache accepted APValue for performance improvement.
----------------
zwuis wrote:

I guessed this PR might introduce a noticeable performance regression, so I left a TODO as a reminder to optimize. Added an optimization and removed the TODO.

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


More information about the cfe-commits mailing list