]> git.ipfire.org Git - thirdparty/gcc.git/commit
c++: Fix ICE with weird copy assignment operator [PR114572]
authorJakub Jelinek <jakub@redhat.com>
Fri, 5 Apr 2024 07:31:28 +0000 (09:31 +0200)
committerJakub Jelinek <jakub@redhat.com>
Sun, 21 Apr 2024 04:08:04 +0000 (06:08 +0200)
commit910fa4d9df8f72d16279324cca2bf1f2649aa68b
tree63e4bd0ee1d40664ced61554c584f6f10fea5b8a
parenta297f9bbb9611414fe48f6d61a8829bf5808bd2c
c++: Fix ICE with weird copy assignment operator [PR114572]

While ctors/dtors don't return anything (undeclared void or this pointer
on arm) and copy assignment operators normally return a reference to *this,
it isn't invalid to return uselessly some class object which might need
destructing, but the OpenMP clause handling code wasn't expecting that.

The following patch fixes that.

2024-04-05  Jakub Jelinek  <jakub@redhat.com>

PR c++/114572
* cp-gimplify.cc (cxx_omp_clause_apply_fn): Call build_cplus_new
on build_call_a result if it has class type.

* testsuite/libgomp.c++/pr114572.C: New test.

(cherry picked from commit 592536eb3c0a97a55b1019ff0216ef77e6ca847e)
gcc/cp/cp-gimplify.cc
libgomp/testsuite/libgomp.c++/pr114572.C [new file with mode: 0644]