public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "gilles.gouaillardet at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
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	[thread overview]
Message-ID: <bug-100381-4@http.gcc.gnu.org/bugzilla/> (raw)

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100381

            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=50732&action=edit
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 reproducer,
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<void,
{anonymous}::DensityFitting::subscribeToPreProcessingNotifications(MdModulesNotifier*)::<lambda(const
IndexGroupsAndNames&)>&, IndexGroupsAndNames>':
/home/users/gilles/local/gcc-11.1.0/include/c++/11.1.0/type_traits:3011:46:  
required from 'constexpr const bool std::is_invocable_r_v<void,
{anonymous}::DensityFitting::subscribeToPreProcessingNotifications(MdModulesNotifier*)::<lambda(const
IndexGroupsAndNames&)>&, IndexGroupsAndNames>'
/home/users/gilles/local/gcc-11.1.0/include/c++/11.1.0/bits/invoke.h:103:27:  
required by substitution of 'template<class _Res, class _Callable, class ...
_Args> constexpr std::enable_if_t<is_invocable_r_v<_Res, _Callable, _Args ...>,
_Res> std::__invoke_r(_Callable&&, _Args&& ...) [with _Res = void; _Callable =
{anonymous}::DensityFitting::subscribeToPreProcessingNotifications(MdModulesNotifier*)::<lambda(const
IndexGroupsAndNames&)>&; _Args = {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 = void;
_Functor =
{anonymous}::DensityFitting::subscribeToPreProcessingNotifications(MdModulesNotifier*)::<lambda(const
IndexGroupsAndNames&)>; _ArgTypes = {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) [with
_Functor =
{anonymous}::DensityFitting::subscribeToPreProcessingNotifications(MdModulesNotifier*)::<lambda(const
IndexGroupsAndNames&)>; <template-parameter-2-2> = void;
<template-parameter-2-3> = void; _Res = void; _ArgTypes =
{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<IndexGroupsAndNames>
>((std::__type_identity<IndexGroupsAndNames>{},
std::__type_identity<IndexGroupsAndNames>()))' 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<void,
{anonymous}::DensityFitting::subscribeToPreProcessingNotifications(MdModulesNotifier*)::<lambda(const
IndexGroupsAndNames&)>&, IndexGroupsAndNames>':
/home/users/gilles/local/gcc-11.1.0/include/c++/11.1.0/type_traits:3016:54:  
required from 'constexpr const bool std::is_nothrow_invocable_r_v<void,
{anonymous}::DensityFitting::subscribeToPreProcessingNotifications(MdModulesNotifier*)::<lambda(const
IndexGroupsAndNames&)>&, IndexGroupsAndNames>'
/home/users/gilles/local/gcc-11.1.0/include/c++/11.1.0/bits/invoke.h:105:14:  
required from 'constexpr std::enable_if_t<is_invocable_r_v<_Res, _Callable,
_Args ...>, _Res> std::__invoke_r(_Callable&&, _Args&& ...) [with _Res = void;
_Callable =
{anonymous}::DensityFitting::subscribeToPreProcessingNotifications(MdModulesNotifier*)::<lambda(const
IndexGroupsAndNames&)>&; _Args = {IndexGroupsAndNames};
std::enable_if_t<is_invocable_r_v<_Res, _Callable, _Args ...>, _Res> = void]'
/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 = void;
_Functor =
{anonymous}::DensityFitting::subscribeToPreProcessingNotifications(MdModulesNotifier*)::<lambda(const
IndexGroupsAndNames&)>; _ArgTypes = {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) [with
_Functor =
{anonymous}::DensityFitting::subscribeToPreProcessingNotifications(MdModulesNotifier*)::<lambda(const
IndexGroupsAndNames&)>; <template-parameter-2-2> = void;
<template-parameter-2-3> = void; _Res = void; _ArgTypes =
{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<IndexGroupsAndNames>
>((std::__type_identity<IndexGroupsAndNames>{},
std::__type_identity<IndexGroupsAndNames>()))' 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 <antoshkka@gmail.com>
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 it.


Could you please assess the validity of the reproducer and rule g++ behavior
w.r.t modern C++ standard?

             reply	other threads:[~2021-05-02 14:15 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-02 14:15 gilles.gouaillardet at gmail dot com [this message]
2021-05-03  8:04 ` [Bug libstdc++/100381] [11/12 Regression] " rguenth at gcc dot gnu.org
2021-07-28  7:06 ` rguenth at gcc dot gnu.org
2021-07-28 10:43 ` redi at gcc dot gnu.org
2022-04-21  7:49 ` rguenth at gcc dot gnu.org
2023-05-29 10:04 ` [Bug libstdc++/100381] [11/12/13/14 " jakub at gcc dot gnu.org
2024-03-27 12:21 ` redi at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-100381-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).