]> git.ipfire.org Git - thirdparty/gcc.git/commit
c++: unresolved overload with comma op [PR115430]
authorMarek Polacek <polacek@redhat.com>
Tue, 25 Jun 2024 21:42:01 +0000 (17:42 -0400)
committerMarek Polacek <polacek@redhat.com>
Mon, 1 Jul 2024 19:08:38 +0000 (15:08 -0400)
commitc847dcf94499da62e5a28921b404e6e561645d99
tree0ea36c59f97a61120820c269ecace29499c3e4cb
parent52d71b6b1f0f465a6cf064f61b22fc99453ec132
c++: unresolved overload with comma op [PR115430]

This works:

  template<typename T>
  int Func(T);
  typedef int (*funcptrtype)(int);
  funcptrtype fp0 = &Func<int>;

but this doesn't:

  funcptrtype fp2 = (0, &Func<int>);

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.
gcc/cp/typeck.cc
gcc/testsuite/g++.dg/cpp0x/noexcept41.C
gcc/testsuite/g++.dg/overload/addr3.C [new file with mode: 0644]