]> git.ipfire.org Git - thirdparty/gcc.git/commit
c++/reflection: fix type_of for member fns [PR123934]
authorMarek Polacek <polacek@redhat.com>
Wed, 4 Feb 2026 16:31:02 +0000 (11:31 -0500)
committerMarek Polacek <polacek@redhat.com>
Thu, 5 Feb 2026 14:16:57 +0000 (09:16 -0500)
commit507ea25cf2e18bba38e28ab7b57cc725895cb067
tree7ee05301d2feff87e44eca909b1106cdc3d22767
parent6385a3582c0b6b30479bc68f7d2b74e327ec44d7
c++/reflection: fix type_of for member fns [PR123934]

Here the assert was wrongly failing with

  'void (struct F::)(int)' is not the same as 'void(int)'

but as per [dcl.fct]/1 the type of fType should not include the class F.

PR c++/123934

gcc/cp/ChangeLog:

* reflect.cc (type_of): For FUNCTION_DECLs, use static_fn_type.

gcc/testsuite/ChangeLog:

* g++.dg/reflect/type_of2.C: Uncomment an assert.

Reviewed-by: Jason Merrill <jason@redhat.com>
gcc/cp/reflect.cc
gcc/testsuite/g++.dg/reflect/type_of2.C