The following code fails to compile: https://godbolt.org/z/briQXa Adding a `noexcept` specifier to the default constructor fixes the issue, but it shouldn't be needed.. Clang compiles this code correctly, so does gcc 4.9. But gcc 7.3 doesn't, for another reason.
#include <type_traits> #include <utility> template<class T> union trivial_helper { T t; }; template <typename T> struct trait { static constexpr bool value = std::is_copy_constructible<trivial_helper<T>>::value; }; struct BlockFrequencyInfoImplBase { struct BlockNode { int Index = 1; BlockNode() = default; }; static constexpr bool v = trait<std::pair<BlockNode, int>>::value; // << remove this line to remove the error void print() const { BlockNode BB; } }; Testcase included inline. Used to be rejected e.g. in r210000, from r216750 and before r250994 used to be rejected with a different error.
r209907 is the first one that rejects it this way, before that the preprocessed source I'm trying doesn't compile because of some __is_trivially_assignable changes, so it is possible 4.9 accepted this with 4.9 headers.
Yes, 4.9 accepts it, but so does 5.5 which contains r209907
Author: jason Date: Wed Feb 20 02:00:29 2019 New Revision: 269032 URL: https://gcc.gnu.org/viewcvs?rev=269032&root=gcc&view=rev Log: PR c++/88368 - wrong 'use of deleted function' Since my patch for 81359 allowed us to signal failure on return from maybe_instantiate_noexcept, we no longer need to turn an error into noexcept(false). We also need to handle NSDMI instantiation errors under synthesized_method_walk. This change caused some instantiation context notes to be lost in the testsuite, so I added push_tinst_level to get_defaulted_eh_spec to restore that context. * method.c (walk_field_subobs): Remember errors from get_nsdmi. (get_defaulted_eh_spec): Call push_tinst_level. * pt.c (maybe_instantiate_noexcept): Keep error_mark_node. * typeck2.c (merge_exception_specifiers): Handle error_mark_node. Added: trunk/gcc/testsuite/g++.dg/ext/is_constructible3.C Modified: trunk/gcc/cp/ChangeLog trunk/gcc/cp/method.c trunk/gcc/cp/pt.c trunk/gcc/cp/typeck2.c trunk/gcc/testsuite/g++.dg/cpp0x/nsdmi3.C
Fixed on trunk so far.
The above change introduced PR89571.
The GCC 7 branch is being closed, re-targeting to GCC 8.4.
GCC 8.4.0 has been released, adjusting target milestone.
The GCC 8 branch is being closed, fixed in GCC 9.1.