From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 207933857C75; Sun, 2 May 2021 14:15:16 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 207933857C75 From: "gilles.gouaillardet at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/100381] New: new static_assert((std::__is_complete_or_unbounded(...)) failure from g++ 11.1.0 Date: Sun, 02 May 2021 14:15:15 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 11.1.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: gilles.gouaillardet at gmail dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone attachments.created Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 02 May 2021 14:15:16 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D100381 Bug ID: 100381 Summary: new static_assert((std::__is_complete_or_unbounded(...)) failure from g++ 11.1.0 Product: gcc Version: 11.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: gilles.gouaillardet at gmail dot com Target Milestone: --- Created attachment 50732 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=3D50732&action=3Dedit a reproducer that fails from g++ 11.1.0 g++ 11.1.0 is no more able to compile GROMACS, as reported at https://gitlab.com/gromacs/gromacs/-/issues/4039 I trimmed the offending code into the attached and self-contained reproduce= r, that fails to build with the following error: $ g++ -c reproducer.cpp In file included from /home/users/gilles/local/gcc-11.1.0/include/c++/11.1.0/bits/move.h:57, from /home/users/gilles/local/gcc-11.1.0/include/c++/11.1.0/bits/stl_function.h:= 60, from /home/users/gilles/local/gcc-11.1.0/include/c++/11.1.0/functional:49, from reproducer.cpp:1: /home/users/gilles/local/gcc-11.1.0/include/c++/11.1.0/type_traits: In instantiation of 'struct std::is_invocable_r&, IndexGroupsAndNames>': /home/users/gilles/local/gcc-11.1.0/include/c++/11.1.0/type_traits:3011:46:= =20=20 required from 'constexpr const bool std::is_invocable_r_v&, IndexGroupsAndNames>' /home/users/gilles/local/gcc-11.1.0/include/c++/11.1.0/bits/invoke.h:103:27= :=20=20 required by substitution of 'template constexpr std::enable_if_t, _Res> std::__invoke_r(_Callable&&, _Args&& ...) [with _Res =3D void; _Calla= ble =3D {anonymous}::DensityFitting::subscribeToPreProcessingNotifications(MdModule= sNotifier*)::&; _Args =3D {IndexGroupsAndNames}]' /home/users/gilles/local/gcc-11.1.0/include/c++/11.1.0/bits/std_function.h:= 291:30: required from 'static _Res std::_Function_handler<_Res(_ArgTypes ...), _Functor>::_M_invoke(const std::_Any_data&, _ArgTypes&& ...) [with _Res =3D= void; _Functor =3D {anonymous}::DensityFitting::subscribeToPreProcessingNotifications(MdModule= sNotifier*)::; _ArgTypes =3D {IndexGroupsAndNames}]' /home/users/gilles/local/gcc-11.1.0/include/c++/11.1.0/bits/std_function.h:= 422:21: required from 'std::function<_Res(_ArgTypes ...)>::function(_Functor) [wi= th _Functor =3D {anonymous}::DensityFitting::subscribeToPreProcessingNotifications(MdModule= sNotifier*)::; =3D void; =3D void; _Res =3D void; _ArgTypes =3D {IndexGroupsAndNames}]' reproducer.cpp:55:56: required from here /home/users/gilles/local/gcc-11.1.0/include/c++/11.1.0/type_traits:2954:7: error: static assertion failed: each argument type must be a complete class= or an unbounded array 2954 | static_assert((std::__is_complete_or_unbounded( | ^~~~~~~~~~~~~ /home/users/gilles/local/gcc-11.1.0/include/c++/11.1.0/type_traits:2954:7: note: 'std::__is_complete_or_unbounded >((std::__type_identity{}, std::__type_identity()))' evaluates to false /home/users/gilles/local/gcc-11.1.0/include/c++/11.1.0/type_traits: In instantiation of 'struct std::is_nothrow_invocable_r&, IndexGroupsAndNames>': /home/users/gilles/local/gcc-11.1.0/include/c++/11.1.0/type_traits:3016:54:= =20=20 required from 'constexpr const bool std::is_nothrow_invocable_r_v&, IndexGroupsAndNames>' /home/users/gilles/local/gcc-11.1.0/include/c++/11.1.0/bits/invoke.h:105:14= :=20=20 required from 'constexpr std::enable_if_t, _Res> std::__invoke_r(_Callable&&, _Args&& ...) [with _Res =3D = void; _Callable =3D {anonymous}::DensityFitting::subscribeToPreProcessingNotifications(MdModule= sNotifier*)::&; _Args =3D {IndexGroupsAndNames}; std::enable_if_t, _Res> =3D vo= id]' /home/users/gilles/local/gcc-11.1.0/include/c++/11.1.0/bits/std_function.h:= 291:30: required from 'static _Res std::_Function_handler<_Res(_ArgTypes ...), _Functor>::_M_invoke(const std::_Any_data&, _ArgTypes&& ...) [with _Res =3D= void; _Functor =3D {anonymous}::DensityFitting::subscribeToPreProcessingNotifications(MdModule= sNotifier*)::; _ArgTypes =3D {IndexGroupsAndNames}]' /home/users/gilles/local/gcc-11.1.0/include/c++/11.1.0/bits/std_function.h:= 422:21: required from 'std::function<_Res(_ArgTypes ...)>::function(_Functor) [wi= th _Functor =3D {anonymous}::DensityFitting::subscribeToPreProcessingNotifications(MdModule= sNotifier*)::; =3D void; =3D void; _Res =3D void; _ArgTypes =3D {IndexGroupsAndNames}]' reproducer.cpp:55:56: required from here /home/users/gilles/local/gcc-11.1.0/include/c++/11.1.0/type_traits:2992:7: error: static assertion failed: each argument type must be a complete class= or an unbounded array 2992 | static_assert((std::__is_complete_or_unbounded( | ^~~~~~~~~~~~~ /home/users/gilles/local/gcc-11.1.0/include/c++/11.1.0/type_traits:2992:7: note: 'std::__is_complete_or_unbounded >((std::__type_identity{}, std::__type_identity()))' evaluates to false The same code can be compiled with previous g++ versions (and many other compilers such as clang++). A "fix" is to replace class IndexGroupsAndNames; with class IndexGroupsAndNames {}; git bisect points to the following commit commit c1fc9f6e10e646f01194c8f150affbc1cfbc404a Author: Antony Polukhin Date: Thu Sep 24 18:51:37 2020 +0100 libstdc++: assert that type traits are not misused with incomplete types [PR 71579] Based on the commit message and me being illiterate in modern C++, I cannot tell whether the reproducer is valid C++, or g++ is right about rejecting i= t. Could you please assess the validity of the reproducer and rule g++ behavior w.r.t modern C++ standard?=