https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106608
Jonathan Wakely <redi at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|[12/13 Regression] |std::optional requires |std::optional requires |unavailable dtor when |unavailable dtor |compiled with clang Keywords|needs-bisection, | |rejects-valid | Target Milestone|12.3 |--- --- Comment #8 from Jonathan Wakely <redi at gcc dot gnu.org> --- Also, there's no regression. I don't know why you think this has anything to do with GCC 12. Given this code: #include <optional> #include <vector> using namespace std; struct ScanInfo; struct List { List(optional<vector<ScanInfo>>&& = nullopt); }; All versions of GCC compile it. Clang rejects it with all libstdc++ headers: $ clang++ -std=c++17 -c inc.cc --gcc-toolchain=$HOME/gcc/8 In file included from inc.cc:2: In file included from /home/jwakely/gcc/8/lib/gcc/x86_64-pc-linux-gnu/8.5.0/../../../../include/c++/8.5.0/vector:62: /home/jwakely/gcc/8/lib/gcc/x86_64-pc-linux-gnu/8.5.0/../../../../include/c++/8.5.0/bits/stl_construct.h:133:7: error: static assertion failed due to requirement 'is_destructible<ScanInfo>::value': value type is destructible $ clang++ -std=c++17 -c inc.cc --gcc-toolchain=$HOME/gcc/9 In file included from inc.cc:2: In file included from /home/jwakely/gcc/9/lib/gcc/x86_64-pc-linux-gnu/9.5.0/../../../../include/c++/9.5.0/vector:65: /home/jwakely/gcc/9/lib/gcc/x86_64-pc-linux-gnu/9.5.0/../../../../include/c++/9.5.0/bits/stl_construct.h:133:7: error: static assertion failed due to requirement 'is_destructible<ScanInfo>::value': value type is destructible $ clang++ -std=c++17 -c inc.cc --gcc-toolchain=$HOME/gcc/10 In file included from inc.cc:1: In file included from /home/jwakely/gcc/10/lib/gcc/x86_64-pc-linux-gnu/10.4.1/../../../../include/c++/10.4.1/optional:36: In file included from /home/jwakely/gcc/10/lib/gcc/x86_64-pc-linux-gnu/10.4.1/../../../../include/c++/10.4.1/utility:70: In file included from /home/jwakely/gcc/10/lib/gcc/x86_64-pc-linux-gnu/10.4.1/../../../../include/c++/10.4.1/bits/stl_pair.h:59: In file included from /home/jwakely/gcc/10/lib/gcc/x86_64-pc-linux-gnu/10.4.1/../../../../include/c++/10.4.1/bits/move.h:57: /home/jwakely/gcc/10/lib/gcc/x86_64-pc-linux-gnu/10.4.1/../../../../include/c++/10.4.1/type_traits:844:7: error: static assertion failed due to requirement 'std::__is_complete_or_unbounded(std::__type_identity<ScanInfo>{})': template argument must be a complete class or an unbounded array $ clang++ -std=c++17 -c inc.cc --gcc-toolchain=$HOME/gcc/11 In file included from inc.cc:1: In file included from /home/jwakely/gcc/11/lib/gcc/x86_64-pc-linux-gnu/11.3.1/../../../../include/c++/11.3.1/optional:36: In file included from /home/jwakely/gcc/11/lib/gcc/x86_64-pc-linux-gnu/11.3.1/../../../../include/c++/11.3.1/utility:70: In file included from /home/jwakely/gcc/11/lib/gcc/x86_64-pc-linux-gnu/11.3.1/../../../../include/c++/11.3.1/bits/stl_pair.h:59: In file included from /home/jwakely/gcc/11/lib/gcc/x86_64-pc-linux-gnu/11.3.1/../../../../include/c++/11.3.1/bits/move.h:57: /home/jwakely/gcc/11/lib/gcc/x86_64-pc-linux-gnu/11.3.1/../../../../include/c++/11.3.1/type_traits:885:7: error: static assertion failed due to requirement 'std::__is_complete_or_unbounded(std::__type_identity<ScanInfo>{})': template argument must be a complete class or an unbounded array $ clang++ -std=c++17 -c inc.cc --gcc-toolchain=$HOME/gcc/12 In file included from inc.cc:1: In file included from /home/jwakely/gcc/12/lib/gcc/x86_64-pc-linux-gnu/12.2.1/../../../../include/c++/12.2.1/optional:37: /home/jwakely/gcc/12/lib/gcc/x86_64-pc-linux-gnu/12.2.1/../../../../include/c++/12.2.1/type_traits:910:7: error: static assertion failed due to requirement 'std::__is_complete_or_unbounded(std::__type_identity<ScanInfo>{})': template argument must be a complete class or an unbounded array