================
@@ -528,3 +528,21 @@ D d(0); // expected-note {{in implicit initialization for 
inherited constructor
 // expected-error@-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
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to