[Bug c++/115430] Cannot take address of template function
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115430 Andrew Pinski changed: What|Removed |Added Target Milestone|--- |14.3
[Bug c++/115430] Cannot take address of template function
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115430 Marek Polacek changed: What|Removed |Added Status|ASSIGNED|RESOLVED Resolution|--- |FIXED --- Comment #7 from Marek Polacek --- Fixed.
[Bug c++/115430] Cannot take address of template function
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115430 --- Comment #6 from GCC Commits --- The releases/gcc-14 branch has been updated by Marek Polacek : https://gcc.gnu.org/g:21600f3a6f23390c25a73e1cbfcfc544b7133d53 commit r14-11169-g21600f3a6f23390c25a73e1cbfcfc544b7133d53 Author: Marek Polacek Date: Tue Jun 25 17:42:01 2024 -0400 c++: unresolved overload with comma op [PR115430] This works: template int Func(T); typedef int (*funcptrtype)(int); funcptrtype fp0 = &Func; but this doesn't: funcptrtype fp2 = (0, &Func); because we only call resolve_nondeduced_context on the LHS (via convert_to_void) but not on the RHS, so cp_build_compound_expr's type_unknown_p check issues an error. PR c++/115430 gcc/cp/ChangeLog: * typeck.cc (cp_build_compound_expr): Call resolve_nondeduced_context on RHS. gcc/testsuite/ChangeLog: * g++.dg/cpp0x/noexcept41.C: Remove dg-error. * g++.dg/overload/addr3.C: New test. (cherry picked from commit c847dcf94499da62e5a28921b404e6e561645d99)
[Bug c++/115430] Cannot take address of template function
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115430 --- Comment #5 from Marek Polacek --- Fixed on trunk. I think I'll backport the fix to 14 as well.
[Bug c++/115430] Cannot take address of template function
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115430 --- Comment #4 from GCC Commits --- The trunk branch has been updated by Marek Polacek : https://gcc.gnu.org/g:c847dcf94499da62e5a28921b404e6e561645d99 commit r15-1759-gc847dcf94499da62e5a28921b404e6e561645d99 Author: Marek Polacek Date: Tue Jun 25 17:42:01 2024 -0400 c++: unresolved overload with comma op [PR115430] This works: template int Func(T); typedef int (*funcptrtype)(int); funcptrtype fp0 = &Func; but this doesn't: funcptrtype fp2 = (0, &Func); because we only call resolve_nondeduced_context on the LHS (via convert_to_void) but not on the RHS, so cp_build_compound_expr's type_unknown_p check issues an error. PR c++/115430 gcc/cp/ChangeLog: * typeck.cc (cp_build_compound_expr): Call resolve_nondeduced_context on RHS. gcc/testsuite/ChangeLog: * g++.dg/cpp0x/noexcept41.C: Remove dg-error. * g++.dg/overload/addr3.C: New test.
[Bug c++/115430] Cannot take address of template function
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115430 Marek Polacek changed: What|Removed |Added Assignee|unassigned at gcc dot gnu.org |mpolacek at gcc dot gnu.org CC||mpolacek at gcc dot gnu.org Status|NEW |ASSIGNED --- Comment #3 from Marek Polacek --- Testing a patch.
[Bug c++/115430] Cannot take address of template function
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115430 Andrew Pinski changed: What|Removed |Added Known to fail||3.4.6 --- Comment #2 from Andrew Pinski --- Note GCC 4.4.7 and before gave the following error message: :5: error: argument of type 'void' does not match 'int (*)(int)'
[Bug c++/115430] Cannot take address of template function
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115430 Andrew Pinski changed: What|Removed |Added Last reconfirmed||2024-06-11 Ever confirmed|0 |1 Known to fail||4.5.3 Status|UNCONFIRMED |NEW --- Comment #1 from Andrew Pinski --- Reduced (and modified to be C++98): ``` template int Func(T); typedef int (*funcptrtype)(int); funcptrtype fp1 = &Func; funcptrtype fp2 = (0, &Func); ```