[clang] [Clang] Fix immediate escalation of template function specializations. (PR #124404)
via cfe-commits
cfe-commits at lists.llvm.org
Mon Jan 27 09:37:36 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}}
----------------
cor3ntin wrote:
i completely removed the conversion to it, it was not salient to the test. this is just testing that tfn becomes immediate
https://github.com/llvm/llvm-project/pull/124404
More information about the cfe-commits
mailing list