public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/101137] New: std::conjunction result error
@ 2021-06-20  0:32 benni.probst at gmx dot de
  2021-06-21 12:51 ` [Bug c++/101137] " redi at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: benni.probst at gmx dot de @ 2021-06-20  0:32 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 101137
           Summary: std::conjunction result error
           Product: gcc
           Version: 11.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: benni.probst at gmx dot de
  Target Milestone: ---

Created attachment 51039
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=51039&action=edit
a concept file passes AND failes test at same time with concept
SignedIntegralConvertCopy

While using a lot of concepts a conjunction that could be proven 1 and 1 and 1
and 0 = 0 turned 1 instead.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug c++/101137] std::conjunction result error
  2021-06-20  0:32 [Bug c++/101137] New: std::conjunction result error benni.probst at gmx dot de
@ 2021-06-21 12:51 ` redi at gcc dot gnu.org
  2021-06-21 12:52 ` redi at gcc dot gnu.org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: redi at gcc dot gnu.org @ 2021-06-21 12:51 UTC (permalink / raw)
  To: gcc-bugs

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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2021-06-21
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |WAITING

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
This is hundreds of lines of code (170kloc preprocessed) that produces 527
lines of output.

Could you at least point us to the relevant part, so we don't have to read and
analyze the entire thing?

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug c++/101137] std::conjunction result error
  2021-06-20  0:32 [Bug c++/101137] New: std::conjunction result error benni.probst at gmx dot de
  2021-06-21 12:51 ` [Bug c++/101137] " redi at gcc dot gnu.org
@ 2021-06-21 12:52 ` redi at gcc dot gnu.org
  2021-06-21 13:14 ` redi at gcc dot gnu.org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: redi at gcc dot gnu.org @ 2021-06-21 12:52 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
And ideally, remove everything not relevant to the bug.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug c++/101137] std::conjunction result error
  2021-06-20  0:32 [Bug c++/101137] New: std::conjunction result error benni.probst at gmx dot de
  2021-06-21 12:51 ` [Bug c++/101137] " redi at gcc dot gnu.org
  2021-06-21 12:52 ` redi at gcc dot gnu.org
@ 2021-06-21 13:14 ` redi at gcc dot gnu.org
  2021-06-21 13:33 ` redi at gcc dot gnu.org
  2021-06-22 12:06 ` redi at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: redi at gcc dot gnu.org @ 2021-06-21 13:14 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> ---
I get the same behaviour if I replace all uses of std::conjunction with fold
expressions and split up your unreadable long lines into simpler atoms (which
also makes the code much simpler) e.g.

template<typename T>
concept SignedIntegral1 = std::is_integral_v<T> && std::is_signed_v<T>;

template<typename T>
concept SignedIntegralRef1
  = std::is_lvalue_reference_v<T> && SignedIntegral1<T>;


template<typename... T>
concept SignedIntegral
  = ((SignedIntegral1<T> || SignedIntegralRef1<T>) && ...);



I think the problem is a simple typo in your is_signed_integral_convert_copy
trait, you use boost::mp11::mp_first<T2<Args1...>>
                                            ^

Presumably that's supposed to be boost::mp11::mp_first<T2<Args2...>>.
                                                              ^

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug c++/101137] std::conjunction result error
  2021-06-20  0:32 [Bug c++/101137] New: std::conjunction result error benni.probst at gmx dot de
                   ` (2 preceding siblings ...)
  2021-06-21 13:14 ` redi at gcc dot gnu.org
@ 2021-06-21 13:33 ` redi at gcc dot gnu.org
  2021-06-22 12:06 ` redi at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: redi at gcc dot gnu.org @ 2021-06-21 13:33 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Jonathan Wakely from comment #3)
> template<typename T>
> concept SignedIntegralRef1
>   = std::is_lvalue_reference_v<T> && SignedIntegral1<T>;

Oops, that should be
std::is_lvalue_reference_v<T> && SignedIntegral1<std::remove_reference_t<T>>
(which is easy to spot when you break the wall of text into pieces).

It's irrelevant here anyway, because you can never have a type like
deque<int&>, so it would make a lot more sense for your code to have separate
concepts as above, and then for the the concepts like Container you only need
to use the SignedIntegral1 concept, because the container's value type can't be
a reference.

N.B. defining traits just to use as arguments to std::conjunction just to
define concepts is ... peculiar.

Why not just define the concepts directly? It will compile much faster.

template<typename T>
concept ContainerOfSignedIntegral
  = Container<T> && SignedIntegral<typename T::value_type>;

template<typename T0, typename T1>
concept SignedIntegralConvertCopy1
  = ContainerOfSignedIntegral<T0> && !ForwardList<T0>
    && ContainerOfSignedIntegral<T1>
    && (!std::same_as<typename T1::value_type, typename T2::value_type>);

template<typename T0, typename... T1>
concept SignedIntegralConvertCopy = (SignedIntegralConvertCopy1<T0, T1> &&
...);

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug c++/101137] std::conjunction result error
  2021-06-20  0:32 [Bug c++/101137] New: std::conjunction result error benni.probst at gmx dot de
                   ` (3 preceding siblings ...)
  2021-06-21 13:33 ` redi at gcc dot gnu.org
@ 2021-06-22 12:06 ` redi at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: redi at gcc dot gnu.org @ 2021-06-22 12:06 UTC (permalink / raw)
  To: gcc-bugs

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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |RESOLVED
         Resolution|---                         |INVALID

--- Comment #5 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Jonathan Wakely from comment #3)
> I think the problem is a simple typo in your is_signed_integral_convert_copy
> trait, you use boost::mp11::mp_first<T2<Args1...>>
>                                             ^
> 
> Presumably that's supposed to be boost::mp11::mp_first<T2<Args2...>>.

So not a bug.
                                                               ^

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-06-22 12:06 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-20  0:32 [Bug c++/101137] New: std::conjunction result error benni.probst at gmx dot de
2021-06-21 12:51 ` [Bug c++/101137] " redi at gcc dot gnu.org
2021-06-21 12:52 ` redi at gcc dot gnu.org
2021-06-21 13:14 ` redi at gcc dot gnu.org
2021-06-21 13:33 ` redi at gcc dot gnu.org
2021-06-22 12:06 ` redi at gcc dot gnu.org

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).