#1085524 gcc-12: Please upgrade Debian 12's GCC version to 12.4

Package:
gcc-12
Source:
gcc-12
Description:
GNU C compiler
Submitter:
cnbatch
Date:
2024-10-20 13:54:02 UTC
Severity:
normal
#1085524#5
Date:
2024-10-20 13:46:57 UTC
From:
To:
Dear Maintainer,

The following C++20 code can be compiled with GCC 12.3 or later but can't be compiled on Debian 12 with GCC 12.2:

```
#include <atomic>
#include <memory>

class A{ int a; };

int main()
{
    std::atomic<std::shared_ptr<A>> a_ptr = std::make_shared<A>();
    a_ptr = nullptr;

    return 0;
}
```

Error Messages:
```
test.cpp: In function ‘int main()’:
test.cpp:9:13: error: ambiguous overload for ‘operator=’ (operand types are ‘std::atomic<std::shared_ptr<A> >’ and ‘std::nullptr_t’)
    9 |     a_ptr = nullptr;
      |             ^~~~~~~
In file included from /usr/include/c++/12/memory:78,
                 from test.cpp:2:
/usr/include/c++/12/bits/shared_ptr_atomic.h:585:12: note: candidate: ‘void std::atomic<std::shared_ptr<_Tp> >::operator=(const std::atomic<std::shared_ptr<_Tp> >&) [with _Tp = A]’ (deleted)
  585 |       void operator=(const atomic&) = delete;
      |            ^~~~~~~~
/usr/include/c++/12/bits/shared_ptr_atomic.h:600:7: note: candidate: ‘void std::atomic<std::shared_ptr<_Tp> >::operator=(std::shared_ptr<_Tp>) [with _Tp = A]’
  600 |       operator=(shared_ptr<_Tp> __desired) noexcept
      |       ^~~~~~~~
```

This may be a bug of GCC 12.2, please upgrade GCC version of Debian 12.