[clang] [Clang] Fix immediate escalation of template function specializations. (PR #124404)
Shafik Yaghmour via cfe-commits
cfe-commits at lists.llvm.org
Mon Jan 27 09:29:02 PST 2025
================
@@ -528,3 +528,21 @@ D d(0); // expected-note {{in implicit initialization for inherited constructor
// expected-error at -1 {{call to immediate function 'GH112677::D::SimpleCtor' is not a constant expression}}
}
+
+namespace GH123405 {
+
+consteval void fn() {}
+
+template <typename>
+constexpr int tfn(int) {
+ auto p = &fn; // expected-note {{'tfn<int>' is an immediate function because its body evaluates the address of a consteval function 'fn'}}
+ return int(p); // expected-error {{cast from pointer to smaller type 'int' loses information}}
----------------
shafik wrote:
Should we also have a success case as well for this particular scenario or is that covered by existing tests?
https://github.com/llvm/llvm-project/pull/124404
More information about the cfe-commits
mailing list