Package: gcc-12 Version: 12.2.0-14 Severity: normal X-Debbugs-Cc: cnba...@gmail.com
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. -- System Information: Debian Release: 12.7 APT prefers stable-updates APT policy: (500, 'stable-updates'), (500, 'stable-security'), (500, 'stable') Architecture: amd64 (x86_64) Kernel: Linux 6.1.0-26-amd64 (SMP w/12 CPU threads; PREEMPT) Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8), LANGUAGE not set Shell: /bin/sh linked to /usr/bin/dash Init: systemd (via /run/systemd/system) LSM: AppArmor: enabled Versions of packages gcc-12 depends on: ii binutils 2.40-2 ii cpp-12 12.2.0-14 ii gcc-12-base 12.2.0-14 ii libc6 2.36-9+deb12u8 ii libcc1-0 12.2.0-14 ii libgcc-12-dev 12.2.0-14 ii libgcc-s1 12.2.0-14 ii libgmp10 2:6.2.1+dfsg1-1.1 ii libisl23 0.25-1.1 ii libmpc3 1.3.1-1 ii libmpfr6 4.2.0-1 ii libstdc++6 12.2.0-14 ii libzstd1 1.5.4+dfsg2-5 ii zlib1g 1:1.2.13.dfsg-1 Versions of packages gcc-12 recommends: ii libc6-dev 2.36-9+deb12u8 Versions of packages gcc-12 suggests: pn gcc-12-doc <none> pn gcc-12-locales <none> pn gcc-12-multilib <none> -- no debconf information